답안 #445617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
445617 2021-07-19T04:49:51 Z aris12345678 XORanges (eJOI19_xoranges) C++14
75 / 100
1000 ms 4140 KB
#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;
            for(int i = 0; i < n; i++) {
                if(i == 0 || i == 1)
                    pref[i+1] = a[i];
                else    
                    pref[i+1] = a[i]^pref[i-1];
            }
        } else {
            if(l%2 != r%2)
                printf("0\n");
            else
                printf("%d\n", pref[r]^pref[l]^a[l-1]);
        }
    }
    return 0;
}

Compilation message

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);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 24 ms 468 KB Output is correct
12 Correct 22 ms 480 KB Output is correct
13 Correct 5 ms 460 KB Output is correct
14 Correct 5 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 2940 KB Output is correct
2 Correct 108 ms 2964 KB Output is correct
3 Correct 110 ms 2988 KB Output is correct
4 Correct 106 ms 3020 KB Output is correct
5 Correct 103 ms 2968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 24 ms 468 KB Output is correct
12 Correct 22 ms 480 KB Output is correct
13 Correct 5 ms 460 KB Output is correct
14 Correct 5 ms 460 KB Output is correct
15 Correct 108 ms 2940 KB Output is correct
16 Correct 108 ms 2964 KB Output is correct
17 Correct 110 ms 2988 KB Output is correct
18 Correct 106 ms 3020 KB Output is correct
19 Correct 103 ms 2968 KB Output is correct
20 Execution timed out 1077 ms 4140 KB Time limit exceeded
21 Halted 0 ms 0 KB -