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 "island.h"
#include<bits/stdc++.h>
using namespace std;
int n;
int ord[305];
int rnk[305];
int par[305];
void solve(int N, int L){
n=N;
ord[1]=rnk[1]=1;
for(int i=2; i<=n ;i++){
ord[i]=query(1,i-1);
rnk[ord[i]]=i;
}
for(int i=1; i<=n ;i++) par[i]=0;
for(int i=2; i<=n ;i++){
int x=ord[i];
if(!par[x]){//leaf
for(int j=1;;j++){
int y=query(x,j);
if(rnk[y]<rnk[x]){
par[x]=y;
break;
}
else par[y]=x;
}
}
}
for(int i=2; i<=n ;i++) answer(par[i],i);
}
# | 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... |
# | 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... |