# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56863 | red1108 | 트리 (KOI16_treeM) | C++17 | 310 ms | 66560 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stack>
using namespace std;
stack<int> ans;
int bumo[200010], input[500010][3], par[200010];
int n, q;
int pfind(int x)
{
if(par[x]==x) return x;
return par[x]=pfind(par[x]);
}
void uni(int a, int b)
{
par[pfind(a)]=pfind(b);
}
int main()
{
int i, a, b;
scanf("%d %d", &n, &q);
par[1]=1;
for(i=2;i<=n;i++)
{
par[i]=i;
scanf("%d", &bumo[i]);
}
for(i=1;i<=q+n-1;i++)
{
scanf("%d %d", &input[i][0], &input[i][1]);
if(input[i][0]==1)
{
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |