Submission #1040300

# Submission time Handle Problem Language Result Execution time Memory
1040300 2024-08-01T00:05:18 Z Edu175 popa (BOI18_popa) C++17
100 / 100
56 ms 832 KB
#include "popa.h"
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(ll i=a,mxcont=b;i<mxcont;i++)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define imp(v) {for(auto jfhg:v)cout<<jfhg<<" ";cout<<"\n";}
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;

int solve(int n, int* L, int* R)
{
	fore(i,0,n)L[i]=R[i]=-1;
	auto gano=[&](ll i, ll j){
		return query(j,i,i,i);
	};
	vector<ll>v;
	fore(i,0,n){
		while(SZ(v)&&gano(i,v.back()))L[i]=v.back(),v.pop_back();
		if(SZ(v))R[v.back()]=i;
		v.pb(i);
	}
    return v[0];
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 348 KB Output is correct
2 Correct 4 ms 356 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 692 KB Output is correct
2 Correct 41 ms 832 KB Output is correct
3 Correct 24 ms 444 KB Output is correct
4 Correct 46 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 432 KB Output is correct
2 Correct 43 ms 672 KB Output is correct
3 Correct 45 ms 584 KB Output is correct
4 Correct 56 ms 440 KB Output is correct