Submission #518291

#TimeUsernameProblemLanguageResultExecution timeMemory
518291lucriXOR Sum (info1cup17_xorsum)C++17
Compilation error
0 ms0 KiB
#include <iostream> using namespace std; long long n,x,ans; bool f[1000010]; int main() { cin>>n; for(int i=1;i<=n;++i) { cin>>x; ++f[x]; if(f[x]==false) f[x]=true; else { f[x]=false; ans=ans^(x+x); } } for(int i=1;i<=1000000;++i) if(f[i]==true) for(int j=i;j<=1000000;++j) { if(f[j]==true) ans=ans^(i+j); } cout<<ans; return 0; }

Compilation message (stderr)

xorsum.cpp: In function 'int main()':
xorsum.cpp:11:14: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   11 |         ++f[x];
      |           ~~~^