Submission #559607

# Submission time Handle Problem Language Result Execution time Memory
559607 2022-05-10T09:23:42 Z Stavab XORanges (eJOI19_xoranges) C++14
0 / 100
753 ms 12440 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    freopen("xoranges.in", "r", stdin);

    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:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("xoranges.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
xoranges.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d", &oranges[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
xoranges.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%d", &move);
      |         ~~~~~^~~~~~~~~~~~~
xoranges.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |             scanf("%d %d", &pos, &val);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:34:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |             scanf("%d %d", &l, &u);
      |             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 693 ms 12432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 679 ms 12440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 693 ms 12432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 753 ms 12352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 693 ms 12432 KB Output isn't correct
2 Halted 0 ms 0 KB -