Submission #18757932


Source Code Expand

#include <atcoder/segtree>
#include <cstdio>
#include <vector>

using namespace std;
using namespace atcoder;

int op(int a, int b) { return (a^b); }

int e() { return 0; }

int target;

bool f(int v) { return v < target; }

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &(a[i]));
    }

    segtree<int, op, e> seg(a);

    for (int i = 0; i < q; i++) {
        int t;
        scanf("%d", &t);
        if (t == 1) {
            int x, y;
            scanf("%d %d", &x, &y);
            x--;
            int v = seg.get(x);
            seg.set(x, v^y);
        } else if (t == 2) {
            int l, r;
            scanf("%d %d", &l, &r);
            l--;
            printf("%d\n", seg.prod(l, r));
        }
    }
}

Submission Info

Submission Time
Task F - Range Xor Query
User samari06
Language C++ (GCC 9.2.1)
Score 600
Code Size 846 Byte
Status AC
Exec Time 158 ms
Memory 8652 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   18 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
./Main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   21 |         scanf("%d", &(a[i]));
      |         ~~~~~^~~~~~~~~~~~~~~
./Main.cpp:28:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   28 |         scanf("%d", &t);
      |         ~~~~~^~~~~~~~~~
./Main.cpp:31:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   31 |             scanf("%d %d", &x, &y);
      |             ~~~~~^~~~~~~~~~~~~~~~~
./Main.cpp:37:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   37 |             scanf("%d %d", &l, &r);
      |             ~~~~~^~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 2
AC × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All handmade_00.txt, handmade_01.txt, max_00.txt, max_01.txt, max_02.txt, max_03.txt, max_04.txt, max_05.txt, max_06.txt, max_07.txt, power_of_2_00.txt, power_of_2_01.txt, power_of_2_02.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
handmade_00.txt AC 9 ms 3092 KiB
handmade_01.txt AC 2 ms 3156 KiB
max_00.txt AC 139 ms 8016 KiB
max_01.txt AC 137 ms 7992 KiB
max_02.txt AC 135 ms 7884 KiB
max_03.txt AC 145 ms 8648 KiB
max_04.txt AC 158 ms 8648 KiB
max_05.txt AC 133 ms 8652 KiB
max_06.txt AC 114 ms 7932 KiB
max_07.txt AC 143 ms 7940 KiB
power_of_2_00.txt AC 108 ms 5772 KiB
power_of_2_01.txt AC 115 ms 5828 KiB
power_of_2_02.txt AC 115 ms 7760 KiB
random_00.txt AC 110 ms 3980 KiB
random_01.txt AC 94 ms 5556 KiB
random_02.txt AC 34 ms 3280 KiB
random_03.txt AC 112 ms 5552 KiB
random_04.txt AC 18 ms 3284 KiB
sample_01.txt AC 2 ms 3072 KiB
sample_02.txt AC 2 ms 3200 KiB