Submission #1249186

#TimeUsernameProblemLanguageResultExecution timeMemory
1249186al95ireyizXORanges (eJOI19_xoranges)C++20
38 / 100
52 ms6340 KiB
//*** Bismillah ***// #pragma GCC optimize("O3", "fast-math", "unroll-loops", "no-stack-protector") #include <bits/stdc++.h> using namespace std; #if !defined(ONLINE_JUDGE) and !defined(EVAL) #include "template/debug.h" #else #define d(x...) #endif #define fr first #define er erase #define sc second #define in insert #define ll long long #define pb push_back #define vll vector<ll> #define pll pair<ll,ll> #define ull unsigned ll #define vpll vector<pll> #define len(x) (ll) x.size() #define all(x) x.begin(),x.end() const ll INF = 1e9; const ll INFL = 1e18; const ll MOD = 1e9+7; // const ll MOD = 998244353; const ll maxn = 2e5+5; ll n,m,k=0; ll a[maxn], fw[maxn][2]; ll get(ll t, ll i){ ll cv = 0; for(; i > 0; i -= i & -i) cv ^= fw[i][t]; return cv; } void upd(ll t, ll i, ll val){ for(; i < maxn; i += i & -i) fw[i][t] ^= val; } void _(ll &tt){ cin >> n >> m; for(ll i = 1; i <= n; i ++){ cin >> a[i]; upd(i % 2, i, a[i]); } for(ll i = 1, t; i <= m; i ++){ cin >> t; if(t == 1){ ll x, y; cin >> x >> y; upd(x % 2, x, y - a[x]); a[x] = y; } else{ ll l, r; cin >> l >> r; if(l % 2 != r % 2){ cout << 0 << '\n'; continue; } cout << (get(l % 2, r) ^ get(l % 2, l - 1)) << '\n'; } } } signed main() { ll tm = clock(); cin.tie(0)->sync_with_stdio(0); ll t = 1; // cin >> t; for(ll tt = 1; tt <= t; tt ++) { _(tt); } cerr << "\n\033[1;31mTime: \033[1;30m" \ << (double)(clock()-tm)/1000000 << "\033[1;32m seconds\n"; }
#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...