Submission #559607

#TimeUsernameProblemLanguageResultExecution timeMemory
559607StavabXORanges (eJOI19_xoranges)C++14
0 / 100
753 ms12440 KiB
#include <bits/stdc++.h> using namespace std; int main() { freopen("xoranges.in", "r", stdin); int n, q; scanf("%d %d", &n, &q); vector<int> oranges(n + 5, 0); for(int i = 1; i <= n; i++) { scanf("%d", &oranges[i]); } int move; while(q--) { scanf("%d", &move); if(move == 1) { int pos, val; scanf("%d %d", &pos, &val); oranges[pos] = val; } else { int l, u; scanf("%d %d", &l, &u); int ans = 0; for(int i = l; i <= u; i+=2) { if ((((i-l+1)%2)*((u-l+1)-(i-l))% 2)%2 == 1) { ans = ans ^ oranges[i]; } } printf("%d\n", ans); } } return 0; }

Compilation message (stderr)

xoranges.cpp: In function 'int main()':
xoranges.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("xoranges.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
xoranges.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d", &oranges[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
xoranges.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%d", &move);
      |         ~~~~~^~~~~~~~~~~~~
xoranges.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |             scanf("%d %d", &pos, &val);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:34:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |             scanf("%d %d", &l, &u);
      |             ~~~~~^~~~~~~~~~~~~~~~~
#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...