답안 #1048942

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1048942 2024-08-08T11:26:15 Z Nickpapadak XORanges (eJOI19_xoranges) C++14
55 / 100
1000 ms 6172 KB
#include<bits/stdc++.h>
using namespace std;
const unsigned int MAXN = 2e+5 + 10;
bool mp[MAXN];
int pf[MAXN], a[MAXN];
int N, Q;
int main(){
    scanf("%d%d",&N,&Q);
    // mp.resize(N+1, 0);
    for(int i = 1; i<=N;++i){
        scanf("%d",&a[i]);
        pf[i] = pf[i-1] ^ a[i];
        mp[i] = 0;
    }
    while(Q--){
        int s,b, type;
        scanf("%d%d%d", &type, &s, &b);
        if(type == 2){
            int ans = 0;
            // for(int i = 1; i <= b-s+1; ++i){
                // for(int j = s; j+i-1 <= b;++j){
                //     ans ^= (pf[j+i-1] ^ pf[j-1]);
                //     // changemp(j+i-1);
                //     // changemp(j+i-1);
                //     for(int k = j; k <= j+i-1; ++k) mp[k] = !mp[k];
                //     // mp[j+i-1] = !mp[j+i-1];
                //     // mp[j-1] = !mp[j-1];
                // }
            // }`
            if((b-s+1) % 2 == 1){
                for(int j = s; j <= b; j+=2){
                    ans ^= a[j];
                }
            }
            // for(int i = 1; i<=N;++i){
                // printf("[%d]", i);
            // }
            // printf("\n");
            // for(int i = 1; i<=N;++i){
                // printf(" %d ", mp[i]);
                // mp[i] = 0;
            // }
            // printf("\n");
            printf("%d\n", ans);
        }else{
            a[s] = b;
            for(int i = s; i<=N;++i){
                pf[i] = pf[i-1] ^ a[i];
            }
        }
    }
    return 0;
}

Compilation message

xoranges.cpp: In function 'int main()':
xoranges.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     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:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%d%d%d", &type, &s, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 344 KB Output is correct
12 Correct 5 ms 600 KB Output is correct
13 Correct 7 ms 616 KB Output is correct
14 Correct 6 ms 608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1065 ms 6172 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 452 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 7 ms 344 KB Output is correct
12 Correct 5 ms 600 KB Output is correct
13 Correct 7 ms 616 KB Output is correct
14 Correct 6 ms 608 KB Output is correct
15 Execution timed out 1065 ms 6172 KB Time limit exceeded
16 Halted 0 ms 0 KB -