Submission #522002

# Submission time Handle Problem Language Result Execution time Memory
522002 2022-02-03T15:09:54 Z maks007 XOR Sum (info1cup17_xorsum) C++14
0 / 100
878 ms 8976 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void) {
	int n;
	cin>> n;
	vector <int> a(n);
	map <int,int> idx;
	for(int i = 0; i < n; i ++ ) {
		cin >> a[i];
		idx[a[i]] ++;
	}
	int ans = 0;
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	for(int i = 0; i < a.size(); i ++) {
		for(int j = 0; j <= i; j ++) {
			if(a[i] < a[j] and idx[a[i]] % 2 == idx[a[j]] % 2 and idx[a[i]] % 2 == 1) {
				ans ^= (a[i] + a[j]);
			}else {
				if(idx[a[i]] % 2 == idx[a[j]] % 2 and idx[a[i]] % 2 == 1 and a[i] == a[j])
					ans ^= (a[i] + a[j]);
			}
		}
	}
	cout << ans;
	return false;
}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:17:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for(int i = 0; i < a.size(); i ++) {
      |                 ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 573 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 878 ms 8976 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 878 ms 8976 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 573 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 573 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -