Submission #67745

#TimeUsernameProblemLanguageResultExecution timeMemory
67745ekremXOR Sum (info1cup17_xorsum)C++98
7 / 100
1663 ms4364 KiB
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define N 1000005 using namespace std; int n, a[N], top, ans, ans2; void yz(int bit){ if(bit == 0)return; yz(bit/2); printf("%d",bit%2); } void yaz(int bit){ yz(bit); puts(""); } int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d",&n); for(int i = 1; i <= n; i++){ scanf("%d", a + i); // yaz(a[i]); top += a[i]; } // cout << "AMK" << ((a[1] + a[2])^(a[1] + a[1])) << endl; // cout <<(a[1]^a[2]) << endl; // puts(""); for(int i = 1; i <= n; i++) for(int j = i; j <= n; j++){ int zorla = 0; for(int k = 0; (1<<k) <= a[i] or (1<<k) <= a[j]; k++){ if(a[i]&(1<<k) and a[j]&(1<<k)) zorla |= (1<<k); if(k > 0 and (a[i]|a[j])&(1<<k) and zorla & (1<<(k - 1))) zorla |= (1<<k); } // yaz(a[i]); // yaz(a[j]); // yaz(a[i] + a[j]); // // yaz( (a[i]|a[j])*2 ); // yaz(a[i]^a[j] ^ ((zorla)*2) ); // puts(""); ans ^= a[i]^a[j]; ans2 ^= a[i]^a[j] ^ ((zorla)*2); } // yaz(ans); // yaz(ans2); printf("%d\n",ans2); return 0; }

Compilation message (stderr)

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