Submission #862178

#TimeUsernameProblemLanguageResultExecution timeMemory
862178iskhakkutbilimpopa (BOI18_popa)C++17
100 / 100
50 ms920 KiB
#include <bits/stdc++.h> #include "popa.h" using namespace std; int solve(int N, int* Left, int* Right){ for(int i = 0; i < N; i++) Left[i] = Right[i] = -1; stack<int> st; for(int i = 0; i < N; i++){ int pref = -1; while(!st.empty()){ int First = st.top(); if(query(First, First, First, i)){ Right[First] = i; break; } pref = First; st.pop(); } Left[i] = pref; st.push(i); } if(st.empty()) assert(false); while(st.size() > 1) st.pop(); return st.top(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...