#include "bits/stdc++.h"
#include "popa.h"
using namespace std;
int solve(int N, int* L, int* R) {
vector<int> stk;
for (int i = 0; i < N; i++) {
L[i] = R[i] = -1;
while (!stk.empty()) {
if (!query(stk.back(), i, i, i)) {
break;
}
L[i] = stk.back();
stk.pop_back();
}
if (!stk.empty()) {
R[stk.back()] = i;
}
stk.push_back(i);
}
return stk[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
396 KB |
Output is correct |
2 |
Correct |
14 ms |
376 KB |
Output is correct |
3 |
Correct |
7 ms |
248 KB |
Output is correct |
4 |
Correct |
13 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
105 ms |
328 KB |
Output is correct |
2 |
Correct |
75 ms |
332 KB |
Output is correct |
3 |
Correct |
70 ms |
372 KB |
Output is correct |
4 |
Correct |
70 ms |
452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
98 ms |
376 KB |
Output is correct |
2 |
Correct |
71 ms |
452 KB |
Output is correct |
3 |
Correct |
90 ms |
424 KB |
Output is correct |
4 |
Correct |
84 ms |
332 KB |
Output is correct |