Submission #212056

# Submission time Handle Problem Language Result Execution time Memory
212056 2020-03-22T07:52:02 Z NONAME Klasika (COCI20_klasika) C++17
33 / 110
5000 ms 9584 KB
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define PB push_back
using namespace std;
typedef long long ll;
const int N = 200100;
const int M = 1000100;
const int oo = 1e9;
vector<int> g[N];
string qr;
int pr[N], kol, xr[N], ans, q;
 
void dfs(int v, int vl){
    ans = max(ans, xr[v] ^ vl);
    
    for (int u : g[v])
        dfs(u, vl);
}
 
int main(){
    
    ios_base::sync_with_stdio(0); cin.tie(0);
    
//    freopen("in.txt","r",stdin);
 
    cin >> q;
    
    pr[0] = -1;
    xr[0] = 0;
    kol = 1;
    
    for (; q; q--){
        cin >> qr;
        
        if (qr[0] == 'Q'){
            int x, y; cin >> x >> y;
            x--; y--;
            
            ans = 0;
            
            dfs(y, xr[x]);
            
            cout << ans << '\n';
        } else {
            int x, y; cin >> x >> y;
            x--;
            
            pr[kol] = x;
            xr[kol] = xr[x] ^ y;
            g[x].PB(kol);
            kol++;
        }
    }
      
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 4992 KB Output is correct
4 Correct 7 ms 4992 KB Output is correct
5 Correct 7 ms 4992 KB Output is correct
6 Correct 7 ms 4992 KB Output is correct
7 Correct 8 ms 5120 KB Output is correct
8 Correct 7 ms 4992 KB Output is correct
9 Correct 7 ms 4992 KB Output is correct
10 Correct 7 ms 4992 KB Output is correct
11 Correct 8 ms 4992 KB Output is correct
12 Correct 7 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 4992 KB Output is correct
4 Correct 7 ms 4992 KB Output is correct
5 Correct 7 ms 4992 KB Output is correct
6 Correct 7 ms 4992 KB Output is correct
7 Correct 8 ms 5120 KB Output is correct
8 Correct 7 ms 4992 KB Output is correct
9 Correct 7 ms 4992 KB Output is correct
10 Correct 7 ms 4992 KB Output is correct
11 Correct 8 ms 4992 KB Output is correct
12 Correct 7 ms 4992 KB Output is correct
13 Correct 8 ms 5120 KB Output is correct
14 Correct 10 ms 5120 KB Output is correct
15 Correct 9 ms 5120 KB Output is correct
16 Correct 9 ms 5248 KB Output is correct
17 Correct 8 ms 5120 KB Output is correct
18 Correct 8 ms 5120 KB Output is correct
19 Correct 8 ms 5120 KB Output is correct
20 Correct 8 ms 5120 KB Output is correct
21 Correct 8 ms 5120 KB Output is correct
22 Correct 8 ms 5120 KB Output is correct
23 Correct 8 ms 5120 KB Output is correct
24 Correct 11 ms 5120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5056 ms 9584 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4992 KB Output is correct
2 Correct 7 ms 4992 KB Output is correct
3 Correct 7 ms 4992 KB Output is correct
4 Correct 7 ms 4992 KB Output is correct
5 Correct 7 ms 4992 KB Output is correct
6 Correct 7 ms 4992 KB Output is correct
7 Correct 8 ms 5120 KB Output is correct
8 Correct 7 ms 4992 KB Output is correct
9 Correct 7 ms 4992 KB Output is correct
10 Correct 7 ms 4992 KB Output is correct
11 Correct 8 ms 4992 KB Output is correct
12 Correct 7 ms 4992 KB Output is correct
13 Correct 8 ms 5120 KB Output is correct
14 Correct 10 ms 5120 KB Output is correct
15 Correct 9 ms 5120 KB Output is correct
16 Correct 9 ms 5248 KB Output is correct
17 Correct 8 ms 5120 KB Output is correct
18 Correct 8 ms 5120 KB Output is correct
19 Correct 8 ms 5120 KB Output is correct
20 Correct 8 ms 5120 KB Output is correct
21 Correct 8 ms 5120 KB Output is correct
22 Correct 8 ms 5120 KB Output is correct
23 Correct 8 ms 5120 KB Output is correct
24 Correct 11 ms 5120 KB Output is correct
25 Execution timed out 5056 ms 9584 KB Time limit exceeded
26 Halted 0 ms 0 KB -