# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
255164 |
2020-07-31T13:11:07 Z |
Kastanda |
popa (BOI18_popa) |
C++11 |
|
94 ms |
384 KB |
// M
#include<bits/stdc++.h>
#include "popa.h"
using namespace std;
/*const int N = 1009;
vector < int > S;
int query(int a, int b, int c, int d)
{
int mn1 = INT_MAX;
int mn2 = INT_MAX;
for (int i = a; i <= b; i ++)
mn1 = min(mn1, S[i]);
for (int i = c; i <= d; i ++)
mn2 = min(mn2, S[i]);
return mn1 == mn2;
}*/
int solve(int n, int * L, int * R)
{
for (int i = 0; i < n; i ++)
L[i] = R[i] = -1;
vector < int > T;
T.push_back(0);
for (int i = 1; i < n; i ++)
{
int last = -1;
while (T.size() && query(T.back(), i, i, i))
last = T.back(), T.pop_back();
if (T.size())
R[T.back()] = i;
L[i] = last;
T.push_back(i);
}
return T[0];
}
/*int main()
{
int L[N], R[N];
int n;
scanf("%d", &n);
S = vector < int > (n, 0);
for (int &a : S)
scanf("%d", &a);
int root = solve(n, L, R);
printf("%d\n", root);
for (int i = 0; i < n; i ++)
printf("%d %d\n", L[i], R[i]);
return 0;
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
256 KB |
Output is correct |
2 |
Correct |
8 ms |
256 KB |
Output is correct |
3 |
Correct |
8 ms |
256 KB |
Output is correct |
4 |
Correct |
8 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
380 KB |
Output is correct |
2 |
Correct |
82 ms |
384 KB |
Output is correct |
3 |
Correct |
55 ms |
376 KB |
Output is correct |
4 |
Correct |
71 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
92 ms |
384 KB |
Output is correct |
2 |
Correct |
94 ms |
384 KB |
Output is correct |
3 |
Correct |
81 ms |
384 KB |
Output is correct |
4 |
Correct |
86 ms |
380 KB |
Output is correct |