Submission #1241479

#TimeUsernameProblemLanguageResultExecution timeMemory
1241479MateiKing80popa (BOI18_popa)C++20
100 / 100
26 ms424 KiB
#include <bits/stdc++.h>
#include "popa.h"

using namespace std;

int solve(int n, int* left, int* right) {
	stack<int> s;
	int rad = -1;
	for (int i = 0; i < n; i ++) {
		left[i] = right[i] = -1;
		while (s.size() && query(i, i, s.top(), i)) {
			right[s.top()] = left[i];
			left[i] = s.top();
			s.pop();
		}
		if (s.size()) 
			right[s.top()] = i;
		else 
			rad = i;
		s.push(i);
	}
	return rad;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...