답안 #1089912

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1089912 2024-09-17T11:46:06 Z lucri popa (BOI18_popa) C++17
100 / 100
70 ms 688 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];
    }
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 7 ms 440 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 676 KB Output is correct
2 Correct 56 ms 672 KB Output is correct
3 Correct 33 ms 428 KB Output is correct
4 Correct 49 ms 688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 668 KB Output is correct
2 Correct 60 ms 680 KB Output is correct
3 Correct 53 ms 440 KB Output is correct
4 Correct 61 ms 440 KB Output is correct