Submission #198294

# Submission time Handle Problem Language Result Execution time Memory
198294 2020-01-25T12:36:27 Z forelax popa (BOI18_popa) C++14
100 / 100
86 ms 376 KB
#include<bits/stdc++.h>
#include "popa.h"
using namespace std;
int solve(int n,int* lf,int* rg){
	stack<int> st;
	for(int i = 0 ; i < n ; i ++){
		lf[i]=-1;
		rg[i]=-1;
		while(st.size()&&!query(st.top(),st.top(),st.top(),i)){
			lf[i]=st.top();
			st.pop();
		}
		if(st.size()){
			rg[st.top()]=i;
		}
		st.push(i);
	}
	while(st.size()>1)st.pop();
	int rez=st.top();
	st.pop();
	return rez;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 248 KB Output is correct
2 Correct 7 ms 296 KB Output is correct
3 Correct 7 ms 276 KB Output is correct
4 Correct 7 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 332 KB Output is correct
2 Correct 76 ms 328 KB Output is correct
3 Correct 48 ms 376 KB Output is correct
4 Correct 64 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 332 KB Output is correct
2 Correct 57 ms 332 KB Output is correct
3 Correct 59 ms 328 KB Output is correct
4 Correct 86 ms 328 KB Output is correct