제출 #498784

#제출 시각아이디문제언어결과실행 시간메모리
498784ahmedfouadnewXOR Sum (info1cup17_xorsum)C++17
0 / 100
275 ms131072 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back int n; vector<int>a[33]; signed main() { scanf("%lld",&n); long long cnto=0,cnte=0; for(int i=0;i<n;i++) { int x; scanf("%lld",&x); cnto+=(x%2); cnte+=(x%2==0); int cur=0; for(int j=0;j<30;j++) { cur+=x&(1ll<<j); a[j].pb(cur); } } for(int i=0;i<30;i++) sort(a[i].begin(),a[i].end()); int ans=0; for(int i=0;i<30;i++) { int cur=0; for(int j=0;j<n;j++) { cur+=n-(lower_bound(a[i].begin(),a[i].end(),(1ll<<(i+1))-a[i][j])-a[i].begin()); } ans|=(cur&1ll)*(1ll<<(i+1)); } ans|=(1ll*cnto*cnte)&1ll; cout<<ans<<endl; }

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

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