Submission #92380

#TimeUsernameProblemLanguageResultExecution timeMemory
92380igzipopa (BOI18_popa)C++17
100 / 100
89 ms376 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...