Submission #521953

# Submission time Handle Problem Language Result Execution time Memory
521953 2022-02-03T13:51:19 Z boykut XOR Sum (info1cup17_xorsum) C++14
18 / 100
163 ms 26564 KB
#include <bits/stdc++.h>

using namespace std ;

long long t[10000001];

void push(int v, int vl, int vr) {

}
void update(int l, int r, int x, int v, int vl, int vr) {

}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	long long a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	if (n <= 4000) {
		long long x = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j <= i; j++) {
				x ^= (a[i] + a[j]);
			}
		}
		cout << x << '\n';
	} else if (*max_element(a, a + n) <= 4000) {
		int N = *max_element(a, a + n);
		vector<int> cnt(N + 1, 0);
		for (int i = 0; i < n; i++) cnt[a[i]]++;
		long long x = 0;
		for (int i = 0; i <= N; i++) {
			if ((cnt[i] * (cnt[i] - 1) / 2 + cnt[i]) & 1)
				x ^= (i + i);
			if (cnt[i] & 1) {
				for (int j = 0; j < i; j++) {
					if (cnt[j] & 1)
						x ^= (i + j);
				}
			}
		}
		cout << x << '\n';
	} else if (*max_element(a, a + n) <= 1000000) {
		int N = *max_element(a, a + n);
		vector<int> cnt(N + 1, 0), CNT(2 * N + 1, 0);
		for (int i = 0; i < n; i++) cnt[a[i]]++;
		for (int i = 0; i < n; i++) {
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 5 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 12724 KB Output is correct
2 Correct 122 ms 11844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 12724 KB Output is correct
2 Correct 122 ms 11844 KB Output is correct
3 Incorrect 163 ms 26564 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 5 ms 388 KB Output is correct
3 Incorrect 17 ms 1988 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 332 KB Output is correct
2 Correct 5 ms 388 KB Output is correct
3 Correct 131 ms 12724 KB Output is correct
4 Correct 122 ms 11844 KB Output is correct
5 Incorrect 163 ms 26564 KB Output isn't correct
6 Halted 0 ms 0 KB -