Submission #973381

# Submission time Handle Problem Language Result Execution time Memory
973381 2024-05-01T21:32:32 Z colossal_pepe Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
0 / 100
3000 ms 4360 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--;
        int mn = a[r], diff = 0;
        for (int i = r - 1; i >= l; i--) {
            diff = max(diff, a[i] - mn);
            mn = min(mn, a[i]);
        }
        cout << (diff <= k) << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3013 ms 4360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3035 ms 1200 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -