제출 #1095448

#제출 시각아이디문제언어결과실행 시간메모리
1095448thangdz2k7XORanges (eJOI19_xoranges)C++17
100 / 100
77 ms8788 KiB
// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int N = 2e5 + 5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

int n, q, a[N];

struct fen{
    int bit[N];

    void upd(int p, int x){
        for (; p <= n; p += p & -p) bit[p] ^= x;
    }

    int get(int l, int r){
        int ans = 0;
        for (l = l - 1; l; l -= l & -l) ans ^= bit[l];
        for (; r; r -= r & -r) ans ^= bit[r];
        return ans;
    }
} T[2];

void solve(){
    cin >> n >> q;
    for (int i = 1; i <= n; ++ i){
        cin >> a[i]; T[i & 1].upd(i, a[i]);
    }
    while (q --){
        int op, l, r; cin >> op >> l >> r;
        if (op & 1){
            T[l & 1].upd(l, a[l] ^ r); a[l] = r;
        }
        else {
            if ((r - l) & 1) cout << 0 << endl;
            else cout << T[l & 1].get(l, r) << endl;
        }
    }
}

int main(){
    if (fopen("pqh.inp", "r")){
        freopen("pqh.inp", "r", stdin);
        freopen("pqh.out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int t = 1; // cin >> t;
    while (t --) solve();
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

xoranges.cpp:18:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   18 | void maxl(auto &a, auto b) {a = max(a, b);}
      |           ^~~~
xoranges.cpp:18:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   18 | void maxl(auto &a, auto b) {a = max(a, b);}
      |                    ^~~~
xoranges.cpp:19:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void minl(auto &a, auto b) {a = min(a, b);}
      |           ^~~~
xoranges.cpp:19:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void minl(auto &a, auto b) {a = min(a, b);}
      |                    ^~~~
xoranges.cpp: In function 'int main()':
xoranges.cpp:57:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   57 |         freopen("pqh.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:58:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |         freopen("pqh.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...