Submission #198296

# Submission time Handle Problem Language Result Execution time Memory
198296 2020-01-25T12:39:46 Z forelax popa (BOI18_popa) C++14
100 / 100
94 ms 376 KB
#include<bits/stdc++.h>
#include "popa.h"
using namespace std;
int solve(int n,int* Left,int* Right){
	stack<int> Stack;
	for(int i = 0 ; i < n ; i ++){
		Left[i]=-1;
		Right[i]=-1;
		while(Stack.size()&&!query(Stack.top(),Stack.top(),Stack.top(),i)){
			Left[i]=Stack.top();
			Stack.pop();
		}
		if(Stack.size()){
			Right[Stack.top()]=i;
		}
		Stack.push(i);
	}
	while(Stack.size()>1)Stack.pop();
	int rez=Stack.top();
	Stack.pop();
	return rez;
}
# Verdict Execution time Memory Grader output
1 Correct 11 ms 248 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 7 ms 248 KB Output is correct
4 Correct 10 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 376 KB Output is correct
2 Correct 54 ms 328 KB Output is correct
3 Correct 53 ms 328 KB Output is correct
4 Correct 94 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 324 KB Output is correct
2 Correct 69 ms 332 KB Output is correct
3 Correct 94 ms 376 KB Output is correct
4 Correct 79 ms 376 KB Output is correct