Submission #1256151

#TimeUsernameProblemLanguageResultExecution timeMemory
1256151gelastropodpopa (BOI18_popa)C++20
100 / 100
26 ms424 KiB
#include "popa.h" #include <bits/stdc++.h> using namespace std; int solve(int N, int* Left, int* Right) { stack<int> stk; stk.push(0); for (int i = 0; i < N; i++) Left[i] = -1, Right[i] = -1; for (int i = 1; i < N; i++) { int prev = -1; while (stk.size() && query(stk.top(), i, i, i)) prev = stk.top(), stk.pop(); Left[i] = prev; if (stk.size()) Right[stk.top()] = i; stk.push(i); } while (stk.size() > 1) stk.pop(); return stk.top(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...