Submission #66506

#TimeUsernameProblemLanguageResultExecution timeMemory
66506Bruteforcemanpopa (BOI18_popa)C++11
100 / 100
128 ms664 KiB
#include <bits/stdc++.h> #include "popa.h" using namespace std; int par[1111]; int solve(int N, int* left, int* right) { int cur = 0; int root = 0; memset(par, -1, sizeof par); for(int i = 0; i < N; i++) { right[i] = -1; left[i] = -1; } for(int i = 1; i < N; i++) { while(cur != -1) { if(query(cur, i, cur, cur) == true) { if(right[cur] != -1){ left[i] = right[cur]; par[right[cur]] = i; } right[cur] = i; par[i] = cur; // cout << "set parent " << i << " " << cur << endl; break; } cur = par[cur]; } if(cur == -1) { par[root] = i; left[i] = root; root = i; // cout << "set parent " << i << " " << -1 << endl; } cur = i; } return root; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...