Submission #1269849

#TimeUsernameProblemLanguageResultExecution timeMemory
1269849faricapopa (BOI18_popa)C++20
0 / 100
5 ms420 KiB
#include <bits/stdc++.h>
#include "popa.h"

using namespace std;

int solve(int N, int* Left, int* Right) {
  stack<int>s;
  s.push(0);
  int prv = -1;
  for(int i=1; i<N; ++i) {
    while(!s.empty() && query(s.top(), i, i, i)) {
      prv = s.top();
      s.pop();
    }
    Left[i] = prv;
    if(!s.empty()) Right[s.top()] = i;
    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...