제출 #128616

#제출 시각아이디문제언어결과실행 시간메모리
128616E869120XOR Sum (info1cup17_xorsum)C++14
18 / 100
196 ms22780 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

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]);
                               ~~~~~^~~~~~~~~~~~~~~
#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...