Submission #445615

#TimeUsernameProblemLanguageResultExecution timeMemory
445615aris12345678XORanges (eJOI19_xoranges)C++14
38 / 100
117 ms7876 KiB
#include <bits/stdc++.h> using namespace std; const int mxN = 2*1e5+5; int a[mxN], pref[mxN]; int main() { int n, q; scanf("%d %d", &n, &q); for(int i = 0; i < n; i++) { scanf("%d", &a[i]); if(i == 0 || i == 1) pref[i+1] = a[i]; else pref[i+1] = a[i]^pref[i-1]; } while(q--) { int type, l, r; scanf("%d %d %d", &type, &l, &r); if(type == 1) a[l-1] = r; else { if(l%2 != r%2) printf("0\n"); else printf("%d\n", pref[r]^pref[l]^a[l-1]); } } return 0; }

Compilation message (stderr)

xoranges.cpp: In function 'int main()':
xoranges.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
xoranges.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
xoranges.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf("%d %d %d", &type, &l, &r);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...