Submission #703040

#TimeUsernameProblemLanguageResultExecution timeMemory
703040siewjhpopa (BOI18_popa)C++17
100 / 100
92 ms416 KiB
#include <bits/stdc++.h> #include "popa.h" using namespace std; int solve(int N, int* Left, int* Right){ stack<int> s; for (int i = 0; i < N; i++){ Left[i] = -1; Right[i] = -1; } for (int i = 0; i < N; i++){ int prv = -1; while (!s.empty()){ int x = s.top(); if (query(x, x, x, i)) { Right[x] = i; break; } prv = x; s.pop(); } Left[i] = prv; s.push(i); } while (s.size() > 1) s.pop(); return s.top(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...