Submission #559609

# Submission time Handle Problem Language Result Execution time Memory
559609 2022-05-10T09:24:02 Z Stavab XORanges (eJOI19_xoranges) C++14
55 / 100
1000 ms 1660 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+=2)
            {
                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);
      |             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory 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 276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 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 276 KB Output is correct
11 Correct 7 ms 312 KB Output is correct
12 Correct 5 ms 324 KB Output is correct
13 Correct 21 ms 336 KB Output is correct
14 Correct 15 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 1660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 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 276 KB Output is correct
11 Correct 7 ms 312 KB Output is correct
12 Correct 5 ms 324 KB Output is correct
13 Correct 21 ms 336 KB Output is correct
14 Correct 15 ms 336 KB Output is correct
15 Execution timed out 1066 ms 1660 KB Time limit exceeded
16 Halted 0 ms 0 KB -