# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
92380 |
2019-01-02T17:16:10 Z |
igzi |
popa (BOI18_popa) |
C++17 |
|
89 ms |
376 KB |
#include <bits/stdc++.h>
#include "popa.h"
#define maxN 1005
using namespace std;
int solve(int n, int* l, int* d){
for(int i=0;i<n;i++) l[i]=d[i]=-1;
int root,i,j,tmp,pom;
vector <int> v;
root=0;
for(i=1;i<n;i++){
tmp=root;
while(tmp!=-1){
v.push_back(tmp);
tmp=d[tmp];
}
pom=-1;
for(j=v.size()-1;j>=0;j--){
if(!query(v[j],i,i,i)) break;
pom=j;
}
if(pom==-1) {l[i]=-1; d[v.back()]=i;}
if(pom==0) {l[i]=v[0]; root=i;}
if(pom>0) {
l[i]=v[pom];
d[v[pom-1]]=i;
}
v.clear();
}
return root;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
8 ms |
248 KB |
Output is correct |
4 |
Correct |
8 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
84 ms |
376 KB |
Output is correct |
2 |
Correct |
76 ms |
376 KB |
Output is correct |
3 |
Correct |
61 ms |
376 KB |
Output is correct |
4 |
Correct |
89 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
376 KB |
Output is correct |
2 |
Correct |
75 ms |
320 KB |
Output is correct |
3 |
Correct |
62 ms |
328 KB |
Output is correct |
4 |
Correct |
58 ms |
328 KB |
Output is correct |