Submission #469662

# Submission time Handle Problem Language Result Execution time Memory
469662 2021-09-01T14:40:39 Z keta_tsimakuridze Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 3584 KB
#include<bits/stdc++.h>
#define f first
#define s second
#define int long long
#define pii pair<int,int>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7; // !
int t,a[N],x[N],n,q;
vector<pair<pii,int > > all;
main(){
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	cin >> q;
	for(int i = 1; i <= q; i++) {
		int l,r,x;
		cin >> l >> r >> x;
		all.push_back({{l,r},x});
	}
	int ans = 0;
	for(int mask = 0; mask <(1 << q); mask++){
		for(int i = 1; i <= n; i++) x[i] = a[i];
		for(int i = 0; i < q; i++) {
			if((1 << i) & mask) {
				for(int j = all[i].f.f; j <= all[i].f.s; j++) x[j] ^= all[i].s;
			}
		}
		for(int i = 1; i <= n;i ++) {
			int sum = 0;
			for(int j = i; j <= n; j++){
				sum += x[j];
				ans += sum * sum;
				ans %= mod;
			}
		}
	}
	cout << ans;
 }

Compilation message

xorsum.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 22 ms 304 KB Output is correct
7 Correct 20 ms 304 KB Output is correct
8 Correct 23 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 3584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2082 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 22 ms 304 KB Output is correct
7 Correct 20 ms 304 KB Output is correct
8 Correct 23 ms 204 KB Output is correct
9 Execution timed out 2049 ms 204 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 22 ms 304 KB Output is correct
7 Correct 20 ms 304 KB Output is correct
8 Correct 23 ms 204 KB Output is correct
9 Execution timed out 2049 ms 204 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 22 ms 304 KB Output is correct
7 Correct 20 ms 304 KB Output is correct
8 Correct 23 ms 204 KB Output is correct
9 Incorrect 72 ms 3584 KB Output isn't correct
10 Halted 0 ms 0 KB -