답안 #61930

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61930 2018-07-27T05:41:49 Z 강태규(#1795) popa (BOI18_popa) C++11
100 / 100
156 ms 700 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include "popa.h"

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int n;

int solve(int N, int * L, int * R) {
    n = N;
    for (int i = 0; i < n; ++i) L[i] = R[i] = -1;
    vector<int> st;
    st.push_back(0);
    for (int i = 1; i < n; ++i) {
        while (!st.empty() && query(st.back(), i, i, i)) {
            R[st.back()] = L[i];
            L[i] = st.back();
            st.pop_back();
        }
        if (!st.empty()) R[st.back()] = i;
        st.push_back(i);
    }
    return st[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 248 KB Output is correct
2 Correct 14 ms 308 KB Output is correct
3 Correct 16 ms 384 KB Output is correct
4 Correct 12 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 660 KB Output is correct
2 Correct 156 ms 696 KB Output is correct
3 Correct 83 ms 696 KB Output is correct
4 Correct 96 ms 696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 696 KB Output is correct
2 Correct 97 ms 696 KB Output is correct
3 Correct 91 ms 700 KB Output is correct
4 Correct 96 ms 700 KB Output is correct