답안 #128616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
128616 2019-07-11T07:36:00 Z E869120 XOR Sum (info1cup17_xorsum) C++14
18 / 100
196 ms 22780 KB
#include <iostream>
using namespace std;
#pragma warning (disable: 4996)

long long N, A[1 << 20], V[1 << 20], ans;

int main() {
	scanf("%lld", &N);
	for (int i = 1; i <= N; i++) scanf("%lld", &A[i]);

	if (N <= 5000) {
		for (int i = 1; i <= N; i++) {
			for (int j = i; j <= N; j++) ans ^= (A[i] + A[j]);
		}
		printf("%lld\n", ans);
	}
	else {
		for (int i = 1; i <= N; i++) V[A[i]]++;
		for (int i = 0; i <= 5000; i++) {
			for (int j = i + 1; j <= 5000; j++) {
				if ((1LL * V[i] * V[j]) % 2LL == 1LL) ans ^= (i + j);
			}
			if ((1LL * V[i] * (V[i] + 1)) / 2LL % 2LL == 1LL) ans ^= (i + i);
		}
		printf("%lld\n", ans);
	}
	return 0;
}

Compilation message

xorsum.cpp:3:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning (disable: 4996)
 
xorsum.cpp: In function 'int main()':
xorsum.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &N);
  ~~~~~^~~~~~~~~~~~
xorsum.cpp:9:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 1; i <= N; i++) scanf("%lld", &A[i]);
                               ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 156 ms 8284 KB Output is correct
2 Correct 149 ms 12020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 156 ms 8284 KB Output is correct
2 Correct 149 ms 12020 KB Output is correct
3 Incorrect 196 ms 22780 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Runtime error 22 ms 2168 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 156 ms 8284 KB Output is correct
4 Correct 149 ms 12020 KB Output is correct
5 Incorrect 196 ms 22780 KB Output isn't correct
6 Halted 0 ms 0 KB -