답안 #908730

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908730 2024-01-16T17:47:20 Z speedcode XORanges (eJOI19_xoranges) C++17
75 / 100
1000 ms 3232 KB
#include <stdio.h>

int main(){
    int n,q;
    scanf("%d", &n);
    scanf("%d", &q);
    long long values[n+2];
    long long temp;
    values[0] = 0;
    values[1] = 0;
    for(int i = 0; i < n; i++){
        scanf("%I64d", &temp);
        values[i+2] = temp ^ values[i];
    }
    for(int i = 0; i < q; i++){
        int typ; 
        scanf("%d", &typ);
        if(typ==2){
            int a,b;
            scanf("%d", &a);
            scanf("%d", &b);
            if((b-a) % 2 == 0){
                printf("%d\n", values[a-1] ^ values[b+1]);
            } else printf("0\n");
        } else {
            int pos;
            scanf("%d", &pos);
            scanf("%I64d", &temp);
            long long diff = (values[pos+1] ^ values[pos-1]) ^ temp;
            for(int j = pos+1; j < n+2; j+=2){
                values[j] = values[j] ^ diff;
            }
        }
    }
}

Compilation message

xoranges.cpp: In function 'int main()':
xoranges.cpp:12:20: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   12 |         scanf("%I64d", &temp);
      |                ~~~~^   ~~~~~
      |                    |   |
      |                    |   long long int*
      |                    int*
      |                %I64lld
xoranges.cpp:23:26: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   23 |                 printf("%d\n", values[a-1] ^ values[b+1]);
      |                         ~^     ~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |                 |
      |                          int               long long int
      |                         %lld
xoranges.cpp:28:24: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   28 |             scanf("%I64d", &temp);
      |                    ~~~~^   ~~~~~
      |                        |   |
      |                        |   long long int*
      |                        int*
      |                    %I64lld
xoranges.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
xoranges.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
xoranges.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%I64d", &temp);
      |         ~~~~~^~~~~~~~~~~~~~~~
xoranges.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%d", &typ);
      |         ~~~~~^~~~~~~~~~~~
xoranges.cpp:20:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |             scanf("%d", &a);
      |             ~~~~~^~~~~~~~~~
xoranges.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |             scanf("%d", &b);
      |             ~~~~~^~~~~~~~~~
xoranges.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |             scanf("%d", &pos);
      |             ~~~~~^~~~~~~~~~~~
xoranges.cpp:28:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |             scanf("%I64d", &temp);
      |             ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 408 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 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 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 408 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 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 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 7 ms 456 KB Output is correct
13 Correct 4 ms 348 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 152 ms 3232 KB Output is correct
2 Correct 199 ms 3068 KB Output is correct
3 Correct 147 ms 3064 KB Output is correct
4 Correct 148 ms 2992 KB Output is correct
5 Correct 146 ms 3156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 408 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 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 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 7 ms 456 KB Output is correct
13 Correct 4 ms 348 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 152 ms 3232 KB Output is correct
16 Correct 199 ms 3068 KB Output is correct
17 Correct 147 ms 3064 KB Output is correct
18 Correct 148 ms 2992 KB Output is correct
19 Correct 146 ms 3156 KB Output is correct
20 Execution timed out 1045 ms 2132 KB Time limit exceeded
21 Halted 0 ms 0 KB -