#include <bits/stdc++.h>
#define maxn 305
#define pii pair<int,int>
using namespace std;
int n;
int br[maxn];
int brcv=1;
vector<int>adj[maxn];
int p[maxn];
int sz[maxn];
int top[maxn];
vector<pair<pii,int>>queries;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>n;
sz[0]=0;
p[0]=0;
top[0]=0;
br[0]=0;
for(int i=1;i<=n;i++)
{
char x;
int a,b;
cin>>x;
if(x=='c')
{
cin>>a>>b;
br[i]=br[a];
queries.push_back({{a,b},-1});
}
else
{
cin>>a;
if(x=='a')
{
adj[br[a]].push_back(brcv);
br[i]=brcv;
p[br[i]]=br[a];
sz[br[i]]=sz[br[a]]+1;
top[br[i]]=i;
brcv++;
}
else
{
br[i]=p[br[a]];
queries.push_back({{-1,-1},top[br[a]]});
}
}
}
//for(int i=0;i<=n;i++)cout<<i<<","<<br[i]<<endl;
//for(int i=0;i<brcv;i++)cout<<i<<","<<top[i]<<","<<sz[i]<<","<<p[i]<<" ";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
520 KB |
Unexpected end of file - int64 expected |
2 |
Incorrect |
2 ms |
632 KB |
Unexpected end of file - int64 expected |
3 |
Incorrect |
2 ms |
752 KB |
Unexpected end of file - int64 expected |
4 |
Incorrect |
2 ms |
752 KB |
Unexpected end of file - int64 expected |
5 |
Incorrect |
2 ms |
752 KB |
Unexpected end of file - int64 expected |
6 |
Incorrect |
2 ms |
760 KB |
Unexpected end of file - int64 expected |
7 |
Incorrect |
2 ms |
788 KB |
Unexpected end of file - int64 expected |
8 |
Incorrect |
2 ms |
804 KB |
Unexpected end of file - int64 expected |
9 |
Incorrect |
2 ms |
820 KB |
Unexpected end of file - int64 expected |
10 |
Incorrect |
2 ms |
824 KB |
Unexpected end of file - int64 expected |
11 |
Incorrect |
2 ms |
872 KB |
Unexpected end of file - int64 expected |
12 |
Incorrect |
2 ms |
984 KB |
Unexpected end of file - int64 expected |
13 |
Incorrect |
2 ms |
984 KB |
Unexpected end of file - int64 expected |
14 |
Incorrect |
2 ms |
984 KB |
Unexpected end of file - int64 expected |
15 |
Incorrect |
2 ms |
984 KB |
Unexpected end of file - int64 expected |
16 |
Incorrect |
2 ms |
984 KB |
Unexpected end of file - int64 expected |
17 |
Incorrect |
2 ms |
1008 KB |
Unexpected end of file - int64 expected |
18 |
Incorrect |
2 ms |
1040 KB |
Unexpected end of file - int64 expected |
19 |
Incorrect |
2 ms |
1056 KB |
Unexpected end of file - int64 expected |
20 |
Incorrect |
2 ms |
1072 KB |
Unexpected end of file - int64 expected |