답안 #703040

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
703040 2023-02-25T17:14:38 Z siewjh popa (BOI18_popa) C++17
100 / 100
92 ms 416 KB
#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
int solve(int N, int* Left, int* Right){
    stack<int> s;
    for (int i = 0; i < N; i++){
        Left[i] = -1;
        Right[i] = -1;
    }
    for (int i = 0; i < N; i++){
        int prv = -1;
        while (!s.empty()){
            int x = s.top();
            if (query(x, x, x, i)) {
                Right[x] = i;
                break;
            }
            prv = x;
            s.pop();
        }
        Left[i] = prv;
        s.push(i);
    }
    while (s.size() > 1) s.pop();
    return s.top();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 10 ms 208 KB Output is correct
4 Correct 10 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 292 KB Output is correct
2 Correct 87 ms 292 KB Output is correct
3 Correct 65 ms 284 KB Output is correct
4 Correct 77 ms 416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 288 KB Output is correct
2 Correct 82 ms 292 KB Output is correct
3 Correct 92 ms 292 KB Output is correct
4 Correct 70 ms 300 KB Output is correct