답안 #559606

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
559606 2022-05-10T09:20:57 Z Stavab XORanges (eJOI19_xoranges) C++14
55 / 100
1000 ms 1344 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, q;
    scanf("%d %d", &n, &q);
    
    vector<int> oranges(n + 5, 0);

    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &oranges[i]);
    }

    int move;
    while(q--)
    {
        scanf("%d", &move);
        
        if(move == 1)
        {
            int pos, val;
            scanf("%d %d", &pos, &val);
            
            oranges[pos] = val;
        }
        else
        {
            int l, u;
            scanf("%d %d", &l, &u);

            int ans = 0;
            for(int i = l; i <= u; i++)
            {
                if ((((i-l+1)%2)*((u-l+1)-(i-l))% 2)%2 == 1)
                {
                    ans = ans ^ oranges[i];
                }
            }
            printf("%d\n", ans);
        }
    }

    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:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d", &oranges[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
xoranges.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d", &move);
      |         ~~~~~^~~~~~~~~~~~~
xoranges.cpp:25:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |             scanf("%d %d", &pos, &val);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:32:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |             scanf("%d %d", &l, &u);
      |             ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 8 ms 212 KB Output is correct
12 Correct 12 ms 212 KB Output is correct
13 Correct 35 ms 332 KB Output is correct
14 Correct 39 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1091 ms 1344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 8 ms 212 KB Output is correct
12 Correct 12 ms 212 KB Output is correct
13 Correct 35 ms 332 KB Output is correct
14 Correct 39 ms 212 KB Output is correct
15 Execution timed out 1091 ms 1344 KB Time limit exceeded
16 Halted 0 ms 0 KB -