# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
466754 | 2021-08-20T15:49:27 Z | mtxas | XORanges (eJOI19_xoranges) | C++14 | 1000 ms | 460 KB |
#include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define fi first #define se second #define pll pair<ll, ll> #define mii map<int, int> #define vi vector<int> #define vll vector<ll> #define pb push_back #define all(a) a.begin(), a.end() #define sz(x) ((int)x.size()) #define turbo() cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false) #define _fre() freopen("input.txt", "r", stdin) #define _for(a, b, c) for(int (a) = (b); (a) < (c); (a)++) #define _foreq(a, b, c) for(int (a) = (b); (a) <= (c); (a)++) #define _forneq(a, b, c) for(int (a) = (b); (a) >= (c); (a)--) #define _forn(a, b, c) for(int (a) = (b); (a) > (c); (a)--) using namespace std; /********************************************************************************** STRUCTS **********************************************************************************/ /********************************************************************************** VARIABLES **********************************************************************************/ const int maxn = 5001; int a[maxn]; int t[maxn<<1]; int startIdRes[maxn]; /********************************************************************************** FUNCTIONS **********************************************************************************/ /********************************************************************************** MAIN **********************************************************************************/ int main(){ // _fre(); turbo(); int n, q; cin>>n>>q; _foreq(i, 1, n) cin>>a[i]; _for(g, 0, q){ int type; cin>>type; if(type == 1){ int i, val; cin>>i>>val; a[i] = val; //cout<<"a["<<i<<"] = "<<val<<endl; } else if(type == 2){ int l, r; cin>>l>>r; // cout<<"query("<<l<<", "<<r<<")\n"; int reply = 0; _foreq(i, 0, r) startIdRes[i] = 0; _foreq(len, 1, r-l+1){ _foreq(startId, l, r-len+1){ int toXor = 0; /*//cout<<"range("<<startId<<", "<<startId+len-1<<")\n"; _foreq(i, startId, startId+len-1){ toXor ^= a[i]; }*/ toXor = startIdRes[startId] ^ a[startId+len-1]; reply ^= toXor; startIdRes[startId] = toXor; } } cout<<reply<<'\n'; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 328 KB | Output is correct |
2 | Correct | 8 ms | 328 KB | Output is correct |
3 | Correct | 10 ms | 332 KB | Output is correct |
4 | Correct | 39 ms | 324 KB | Output is correct |
5 | Correct | 39 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 9 ms | 328 KB | Output is correct |
7 | Correct | 8 ms | 328 KB | Output is correct |
8 | Correct | 10 ms | 332 KB | Output is correct |
9 | Correct | 39 ms | 324 KB | Output is correct |
10 | Correct | 39 ms | 204 KB | Output is correct |
11 | Execution timed out | 1073 ms | 332 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 9 ms | 328 KB | Output is correct |
7 | Correct | 8 ms | 328 KB | Output is correct |
8 | Correct | 10 ms | 332 KB | Output is correct |
9 | Correct | 39 ms | 324 KB | Output is correct |
10 | Correct | 39 ms | 204 KB | Output is correct |
11 | Execution timed out | 1073 ms | 332 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |