Submission #1017780

# Submission time Handle Problem Language Result Execution time Memory
1017780 2024-07-09T10:08:46 Z vjudge1 Klasika (COCI20_klasika) C++17
33 / 110
5000 ms 6844 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
const int M = 1e5 + 1;

int ans,xx,val[M];
vector<int> nei[M];

void dfs(int u)
{
	ans=max(ans,val[u]^xx);
	for (int i:nei[u])
		dfs(i);
}

signed main()
{
	int q;
	cin>>q;
	int nd=1;
	while (q--)
	{
		string s;
		cin>>s;
		if (s=="Add")
		{
			int x,y;
			cin>>x>>y;
			val[++nd]=val[x]^y;
			nei[x].push_back(nd);
		}
		else
		{
			int a,b;
			cin>>a>>b;
			ans=0,xx=val[a];
			dfs(b);
			cout<<ans<<endl;
		}
	}
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 2 ms 2908 KB Output is correct
12 Correct 2 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 2 ms 2908 KB Output is correct
12 Correct 2 ms 2652 KB Output is correct
13 Correct 4 ms 2652 KB Output is correct
14 Correct 4 ms 2652 KB Output is correct
15 Correct 4 ms 2908 KB Output is correct
16 Correct 3 ms 2908 KB Output is correct
17 Correct 4 ms 2652 KB Output is correct
18 Correct 3 ms 2652 KB Output is correct
19 Correct 3 ms 2652 KB Output is correct
20 Correct 2 ms 2652 KB Output is correct
21 Correct 3 ms 2652 KB Output is correct
22 Correct 6 ms 2840 KB Output is correct
23 Correct 5 ms 2652 KB Output is correct
24 Correct 3 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5017 ms 6844 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 1 ms 2652 KB Output is correct
5 Correct 1 ms 2652 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 2 ms 2652 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 2 ms 2908 KB Output is correct
12 Correct 2 ms 2652 KB Output is correct
13 Correct 4 ms 2652 KB Output is correct
14 Correct 4 ms 2652 KB Output is correct
15 Correct 4 ms 2908 KB Output is correct
16 Correct 3 ms 2908 KB Output is correct
17 Correct 4 ms 2652 KB Output is correct
18 Correct 3 ms 2652 KB Output is correct
19 Correct 3 ms 2652 KB Output is correct
20 Correct 2 ms 2652 KB Output is correct
21 Correct 3 ms 2652 KB Output is correct
22 Correct 6 ms 2840 KB Output is correct
23 Correct 5 ms 2652 KB Output is correct
24 Correct 3 ms 2652 KB Output is correct
25 Execution timed out 5017 ms 6844 KB Time limit exceeded
26 Halted 0 ms 0 KB -