제출 #48550

#제출 시각아이디문제언어결과실행 시간메모리
48550PajarajaXOR Sum (info1cup17_xorsum)C++17
100 / 100
935 ms37680 KiB
#include <bits/stdc++.h> using namespace std; int a[1000007],c[1000007]; int main() { int n,sol=0; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int j=0;j<31;j++) { int b=(1<<j),t=0; long long bc=0; if(j) for(int i=1;i<=n;i++) if((a[i] | (1<<(j-1)))!=a[i]) c[++t]=a[i]; if(j) for(int i=1;i<=n;i++) if((a[i] | (1<<(j-1)))==a[i]) c[++t]=a[i]; if(j) for(int i=1;i<=n;i++) {a[i]=c[i]; c[i]=a[i]%b;} for(int i=1;i<=n;i++) if((a[i] | b) == a[i]) bc++; long long k=0; int t1=1,t2=n; while(t1<=n) { while(c[t2]+c[t1]>=b) t2--; k+=(n-t2); t1++; } for(int i=1;i<=n;i++) if(2*c[i]>=b) k++; if((k/2+bc*(n-bc))%2==1) sol+=b; } printf("%d",sol); }

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

xorsum.cpp: In function 'int main()':
xorsum.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
xorsum.cpp:8:29: 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("%d",&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...