# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
73659 |
2018-08-28T16:29:51 Z |
yusufake |
popa (BOI18_popa) |
C++11 |
|
142 ms |
704 KB |
#include<bits/stdc++.h>
using namespace std;
#include "popa.h"
#define _ int v, int tl, int tr, int l, int r
#define tm (tl+tr >> 1)
#define sol v+v,tl,tm,l,r
#define sag v+v+1,tm+1,tr,l,r
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define pp pair<int,int>
const int mod = 1e9 + 7;
const int N = 1e3 + 3;
int L[N],R[N];
int f(int l, int r, int *lef, int *rig){
if(l > r) return -1;
int i;
for(i=l;i<=r;i++)
if(L[i] < l && R[i] > r)
break;
lef[i] = f(l,i-1,lef,rig);
rig[i] = f(i+1,r,lef,rig);
return i;
}
stack < int > S;
int solve(int n, int *lef, int *rig){
int i;
for(i=0;i<n;i++){
for(; S.size() && query(S.top(),i,i,i) ;){
R[ S.top() ] = i;
S.pop();
}
L[i] = S.size() ? S.top() : -1;
S.push(i);
}
for(; S.size() ;){
R[ S.top() ] = n;
S.pop();
}
return f(0,n-1,lef,rig);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
376 KB |
Output is correct |
2 |
Correct |
14 ms |
376 KB |
Output is correct |
3 |
Correct |
20 ms |
516 KB |
Output is correct |
4 |
Correct |
15 ms |
516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
572 KB |
Output is correct |
2 |
Correct |
84 ms |
628 KB |
Output is correct |
3 |
Correct |
63 ms |
652 KB |
Output is correct |
4 |
Correct |
142 ms |
652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
102 ms |
700 KB |
Output is correct |
2 |
Correct |
71 ms |
700 KB |
Output is correct |
3 |
Correct |
100 ms |
700 KB |
Output is correct |
4 |
Correct |
108 ms |
704 KB |
Output is correct |