답안 #973393

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973393 2024-05-01T22:09:18 Z colossal_pepe Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 4188 KB
#include <bits/stdc++.h>
using namespace std;

int n, m;
vector<int> a;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (n > 5000) exit(0);
    cin >> n >> m;
    a.resize(n);
    for (int &x : a) {
        cin >> x;
    }
    while (m--) {
        int l, r, k;
        cin >> l >> r >> k;
        l--, r--;
        stack<int> st;
        int cost = 0;
        for (int i = l; i <= r; i++) {
            while (not st.empty() and a[st.top()] <= a[i]) st.pop();
            if (not st.empty()) cost = max(cost, a[i] + a[st.top()]);
            st.push(i);
        }
        cout << (cost <= k) << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 28 ms 348 KB Output is correct
13 Correct 33 ms 584 KB Output is correct
14 Correct 55 ms 604 KB Output is correct
15 Correct 56 ms 608 KB Output is correct
16 Correct 48 ms 348 KB Output is correct
17 Correct 27 ms 348 KB Output is correct
18 Correct 46 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3038 ms 4188 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3017 ms 848 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 28 ms 348 KB Output is correct
13 Correct 33 ms 584 KB Output is correct
14 Correct 55 ms 604 KB Output is correct
15 Correct 56 ms 608 KB Output is correct
16 Correct 48 ms 348 KB Output is correct
17 Correct 27 ms 348 KB Output is correct
18 Correct 46 ms 1108 KB Output is correct
19 Execution timed out 3043 ms 3404 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 8 ms 348 KB Output is correct
12 Correct 28 ms 348 KB Output is correct
13 Correct 33 ms 584 KB Output is correct
14 Correct 55 ms 604 KB Output is correct
15 Correct 56 ms 608 KB Output is correct
16 Correct 48 ms 348 KB Output is correct
17 Correct 27 ms 348 KB Output is correct
18 Correct 46 ms 1108 KB Output is correct
19 Execution timed out 3038 ms 4188 KB Time limit exceeded
20 Halted 0 ms 0 KB -