Submission #521807

# Submission time Handle Problem Language Result Execution time Memory
521807 2022-02-03T08:09:38 Z maks007 XOR Sum (info1cup17_xorsum) C++14
0 / 100
1600 ms 8268 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void) {
	int n;
	cin>> n;
	vector <int> a(n);
	vector <int> idx((int)1e6, 0);
	for(int i = 0; i < n; i ++ ) {
		cin >> a[i];
		idx[a[i]] ++;
	}
	int ans = 0;
	for(int i = 0; i < a.size(); i ++) {
		if(idx[a[i]] % 2 == 1){
			for(int j = 0; j < a.size(); j ++) {
				ans ^= (a[i] + a[j]);
				//cout << a[i] + a[j] << "  ";
			}
		}
	}
	cout << ans;
	return false;
}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:15:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(int i = 0; i < a.size(); i ++) {
      |                 ~~^~~~~~~~~~
xorsum.cpp:17:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |    for(int j = 0; j < a.size(); j ++) {
      |                   ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 8268 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1689 ms 8012 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1689 ms 8012 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 8268 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 8268 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -