Submission #559605

# Submission time Handle Problem Language Result Execution time Memory
559605 2022-05-10T09:19:30 Z Stavab XORanges (eJOI19_xoranges) C++14
55 / 100
1000 ms 3540 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)*((u-l+1)-(i-l)) % 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 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 216 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 216 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 308 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 11 ms 440 KB Output is correct
12 Correct 8 ms 448 KB Output is correct
13 Correct 30 ms 424 KB Output is correct
14 Correct 31 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 3540 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 216 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 308 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 11 ms 440 KB Output is correct
12 Correct 8 ms 448 KB Output is correct
13 Correct 30 ms 424 KB Output is correct
14 Correct 31 ms 416 KB Output is correct
15 Execution timed out 1061 ms 3540 KB Time limit exceeded
16 Halted 0 ms 0 KB -