답안 #501891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
501891 2022-01-04T18:25:24 Z nighty Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
8 / 100
3000 ms 6216 KB
#include <bits/stdc++.h>

using namespace std;

bool canSort(vector<int>& a, int l, int r, int k) {
    for (int i = l; i < r; ++i) {
        int maxVal = 0;
        for (int j = i + 1; j <= r; ++j) {
            if (a[i] > a[j] && (min(a[i], a[j]) + maxVal > k || a[i] + a[j] > k)) {
                return false;
            }
            maxVal = max(maxVal, a[j]);
        }
    }
    return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (auto& i : a) {
        cin >> i;
    }
    while (m--) {
        int l, r, k;
        cin >> l >> r >> k;
        --l, --r;
        cout << canSort(a, l, r, k) << '\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 28 ms 320 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 12 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 28 ms 320 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 12 ms 204 KB Output is correct
11 Correct 12 ms 332 KB Output is correct
12 Correct 98 ms 540 KB Output is correct
13 Correct 55 ms 424 KB Output is correct
14 Correct 131 ms 464 KB Output is correct
15 Correct 72 ms 448 KB Output is correct
16 Execution timed out 3083 ms 332 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 434 ms 6180 KB Output is correct
2 Correct 424 ms 6216 KB Output is correct
3 Correct 424 ms 6156 KB Output is correct
4 Correct 443 ms 6184 KB Output is correct
5 Execution timed out 3086 ms 4172 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3088 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 28 ms 320 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 12 ms 204 KB Output is correct
11 Correct 12 ms 332 KB Output is correct
12 Correct 98 ms 540 KB Output is correct
13 Correct 55 ms 424 KB Output is correct
14 Correct 131 ms 464 KB Output is correct
15 Correct 72 ms 448 KB Output is correct
16 Execution timed out 3083 ms 332 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 28 ms 320 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 12 ms 204 KB Output is correct
11 Correct 12 ms 332 KB Output is correct
12 Correct 98 ms 540 KB Output is correct
13 Correct 55 ms 424 KB Output is correct
14 Correct 131 ms 464 KB Output is correct
15 Correct 72 ms 448 KB Output is correct
16 Execution timed out 3083 ms 332 KB Time limit exceeded
17 Halted 0 ms 0 KB -