Submission #260253

# Submission time Handle Problem Language Result Execution time Memory
260253 2020-08-09T22:01:07 Z caoash popa (BOI18_popa) C++14
100 / 100
100 ms 500 KB
#include <bits/stdc++.h> 
#include "popa.h"
using namespace std;

using ll = long long;

using vi = vector<int>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair

int solve(int N, int *L, int *R) {
    vector<int> st;
    st.pb(0);
    L[0] = R[0] = -1;
    for (int i = 1; i < N; i++) {
        L[i] = -1, R[i] = -1;
        while (!st.empty() && query(st.back(), i, i, i)) {
            L[i] = st.back();
            st.pop_back();
        }
        if (!st.empty()) {
            R[st.back()] = i;
        }
        st.pb(i);
    }
    return st.front();
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 9 ms 256 KB Output is correct
3 Correct 9 ms 256 KB Output is correct
4 Correct 9 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 100 ms 376 KB Output is correct
2 Correct 49 ms 384 KB Output is correct
3 Correct 63 ms 500 KB Output is correct
4 Correct 91 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 384 KB Output is correct
2 Correct 85 ms 376 KB Output is correct
3 Correct 79 ms 380 KB Output is correct
4 Correct 93 ms 376 KB Output is correct