Submission #844485

#TimeUsernameProblemLanguageResultExecution timeMemory
844485konberXORanges (eJOI19_xoranges)C++14
55 / 100
1018 ms3724 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N, Q;
    scanf("%d%d", &N, &Q);
    vector<int> a(N+1);
    for(int i=1; i <= N; i++)
        scanf("%d", &a[i]);

    while(Q--){
        int q, i, j;
        scanf("%d%d%d", &q, &i, &j);
        if(q==1){
            a[i] = j;
        }
        else{
            int ans=0;
            for(int k=i; k <= j; k++){
                int pl = (k-i+1)*(j-k+1);
                if(pl%2==1) ans ^= a[k];
            }
            printf("%d\n", ans);
        }
    }
}

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:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
xoranges.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d%d%d", &q, &i, &j);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...