Submission #291126

# Submission time Handle Problem Language Result Execution time Memory
291126 2020-09-04T17:34:56 Z penguinhacker Klasika (COCI20_klasika) C++17
33 / 110
5000 ms 9020 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

const int mxN=2e5;
int n=1, val[mxN];
vector<int> adj[mxN];

int dfs(int u, int x) {
	int MX=x^val[u];
	for (int v: adj[u]) {
		MX=max(MX, dfs(v, x));
	}
	return MX;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int q; cin >> q;
	while(q--) {
		string type; cin >> type;
		int a, b; cin >> a >> b;
		if (type=="Add") {
			--a;
			val[n]=val[a]^b;
			adj[a].push_back(n);
			++n;
		}
		if (type=="Query") {
			--a, --b;
			cout << dfs(b, val[a]) << "\n";
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5120 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5120 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 7 ms 5120 KB Output is correct
14 Correct 6 ms 5120 KB Output is correct
15 Correct 6 ms 5248 KB Output is correct
16 Correct 6 ms 5232 KB Output is correct
17 Correct 5 ms 5120 KB Output is correct
18 Correct 6 ms 5120 KB Output is correct
19 Correct 5 ms 5120 KB Output is correct
20 Correct 5 ms 5120 KB Output is correct
21 Correct 5 ms 5120 KB Output is correct
22 Correct 5 ms 5120 KB Output is correct
23 Correct 5 ms 5120 KB Output is correct
24 Correct 5 ms 5120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5059 ms 9020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5120 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 4 ms 4992 KB Output is correct
6 Correct 4 ms 4992 KB Output is correct
7 Correct 4 ms 4992 KB Output is correct
8 Correct 4 ms 4992 KB Output is correct
9 Correct 4 ms 4992 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 4 ms 4992 KB Output is correct
13 Correct 7 ms 5120 KB Output is correct
14 Correct 6 ms 5120 KB Output is correct
15 Correct 6 ms 5248 KB Output is correct
16 Correct 6 ms 5232 KB Output is correct
17 Correct 5 ms 5120 KB Output is correct
18 Correct 6 ms 5120 KB Output is correct
19 Correct 5 ms 5120 KB Output is correct
20 Correct 5 ms 5120 KB Output is correct
21 Correct 5 ms 5120 KB Output is correct
22 Correct 5 ms 5120 KB Output is correct
23 Correct 5 ms 5120 KB Output is correct
24 Correct 5 ms 5120 KB Output is correct
25 Execution timed out 5059 ms 9020 KB Time limit exceeded
26 Halted 0 ms 0 KB -