Submission #1319683

#TimeUsernameProblemLanguageResultExecution timeMemory
1319683muhammad-ahmadXOR Sum (info1cup17_xorsum)C++20
11 / 100
73 ms8244 KiB
// #include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <set>
#include <deque>
#include <numeric>
#include <stack>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

void fast_io() {
	// freopen("", "r", stdin);
	// freopen("", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	cout << setprecision(9);
}

#define int long long
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int N = 4e3 + 5;

int C[N] = {};

void solve() {
	int n; cin >> n;
	int a[n + 1];
	for (int i = 1; i <= n; i++) cin >> a[i];
	int ans = 0;
	for (int i = 1; i <= n; i++) C[a[i]]++;
	for (int i = 1; i <= 2 * N; i++){
		for (int j = 1; j < i; j++){
			int x = j, y = i - j;
			if (x >= N or y >= N) continue;
			if (x > y) break;
			if (x != y){
				int c = C[x] * C[y];
				if (c % 2) ans = (ans ^ i);
			}
			else {
				int c = (C[x] * (C[y] - 1)) / 2 + C[x];
				if (i == 12 && j == 3) cout << c << endl;
				if (c % 2) ans = (ans ^ i);
			}
		}
	}
	cout << ans << endl;
}

signed main() {
	fast_io();
	srand(chrono::steady_clock::now().time_since_epoch().count());
	int tc = 1;
	// cin >> tc;
	while (tc--) solve();
	return 0;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...