Submission #501892

# Submission time Handle Problem Language Result Execution time Memory
501892 2022-01-04T18:25:55 Z nighty Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
8 / 100
3000 ms 6212 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] && (false || 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;
}
# Verdict Execution time Memory 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 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 25 ms 204 KB Output is correct
9 Correct 10 ms 308 KB Output is correct
10 Correct 9 ms 308 KB Output is correct
# Verdict Execution time Memory 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 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 25 ms 204 KB Output is correct
9 Correct 10 ms 308 KB Output is correct
10 Correct 9 ms 308 KB Output is correct
11 Correct 17 ms 204 KB Output is correct
12 Correct 129 ms 320 KB Output is correct
13 Correct 88 ms 336 KB Output is correct
14 Correct 199 ms 332 KB Output is correct
15 Correct 129 ms 328 KB Output is correct
16 Execution timed out 3072 ms 276 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 439 ms 6212 KB Output is correct
2 Correct 446 ms 6148 KB Output is correct
3 Correct 447 ms 6156 KB Output is correct
4 Correct 442 ms 6212 KB Output is correct
5 Execution timed out 3080 ms 4172 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3082 ms 716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 25 ms 204 KB Output is correct
9 Correct 10 ms 308 KB Output is correct
10 Correct 9 ms 308 KB Output is correct
11 Correct 17 ms 204 KB Output is correct
12 Correct 129 ms 320 KB Output is correct
13 Correct 88 ms 336 KB Output is correct
14 Correct 199 ms 332 KB Output is correct
15 Correct 129 ms 328 KB Output is correct
16 Execution timed out 3072 ms 276 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 25 ms 204 KB Output is correct
9 Correct 10 ms 308 KB Output is correct
10 Correct 9 ms 308 KB Output is correct
11 Correct 17 ms 204 KB Output is correct
12 Correct 129 ms 320 KB Output is correct
13 Correct 88 ms 336 KB Output is correct
14 Correct 199 ms 332 KB Output is correct
15 Correct 129 ms 328 KB Output is correct
16 Execution timed out 3072 ms 276 KB Time limit exceeded
17 Halted 0 ms 0 KB -