제출 #143462

#제출 시각아이디문제언어결과실행 시간메모리
143462bortozpopa (BOI18_popa)C++17
100 / 100
105 ms452 KiB
#include "bits/stdc++.h"
#include "popa.h"
using namespace std;

int solve(int N, int* L, int* R) {
  vector<int> stk;
  for (int i = 0; i < N; i++) {
    L[i] = R[i] = -1;
    while (!stk.empty()) {
      if (!query(stk.back(), i, i, i)) {
        break;
      }
      L[i] = stk.back();
      stk.pop_back();
    }
    if (!stk.empty()) {
      R[stk.back()] = i;
    }
    stk.push_back(i);
  }
  return stk[0];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...