답안 #1048894

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

Compilation message

xoranges.cpp: In function 'int main()':
xoranges.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d%d",&N,&Q);
      |     ~~~~~^~~~~~~~~~~~~~
xoranges.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         scanf("%d",&a[i]);
      |         ~~~~~^~~~~~~~~~~~
xoranges.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d%d%d", &type, &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 348 KB Output is correct
2 Correct 6 ms 348 KB Output is correct
3 Correct 7 ms 348 KB Output is correct
4 Correct 27 ms 460 KB Output is correct
5 Correct 27 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1066 ms 3932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -