Submission #260246

# Submission time Handle Problem Language Result Execution time Memory
260246 2020-08-09T21:49:25 Z caoash popa (BOI18_popa) C++14
100 / 100
102 ms 744 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)) {
            L[i] = st.back();
            st.pop_back();
        }
        if (!st.empty()) R[st.back()] = i;
        st.push_back(i);
    }
    return st[0];
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 256 KB Output is correct
2 Correct 11 ms 256 KB Output is correct
3 Correct 9 ms 256 KB Output is correct
4 Correct 11 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 380 KB Output is correct
2 Correct 94 ms 384 KB Output is correct
3 Correct 51 ms 376 KB Output is correct
4 Correct 88 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 90 ms 744 KB Output is correct
2 Correct 91 ms 508 KB Output is correct
3 Correct 96 ms 380 KB Output is correct
4 Correct 102 ms 380 KB Output is correct