Submission #1061639

# Submission time Handle Problem Language Result Execution time Memory
1061639 2024-08-16T11:22:09 Z VMaksimoski008 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 8204 KB
#include <bits/stdc++.h>
//#define int long long

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;

signed main() {
    ios_base::sync_with_stdio(false);
    cout.tie(0); cin.tie(0);

    int n, q;
    cin >> n >> q;

    vector<int> v(n+1);
    for(int i=1; i<=n; i++) cin >> v[i];

    while(q--) {
        int l, r, k;
        cin >> l >> r >> k;
        bool ok = 1;
        int mx = v[l];
        for(int i=l+1; i<=r&&ok; i++) {
            if(mx > v[i] && mx + v[i] > k) ok = 0;
            mx = max(mx, v[i]);
        }
        cout << ok << '\n';
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 372 KB Output is correct
16 Correct 8 ms 344 KB Output is correct
17 Correct 13 ms 348 KB Output is correct
18 Correct 15 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 354 ms 6304 KB Output is correct
2 Correct 378 ms 6160 KB Output is correct
3 Correct 409 ms 6232 KB Output is correct
4 Correct 344 ms 6228 KB Output is correct
5 Execution timed out 3046 ms 4360 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 427 ms 864 KB Output is correct
2 Correct 1338 ms 2752 KB Output is correct
3 Execution timed out 3033 ms 2704 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 372 KB Output is correct
16 Correct 8 ms 344 KB Output is correct
17 Correct 13 ms 348 KB Output is correct
18 Correct 15 ms 344 KB Output is correct
19 Correct 1510 ms 8144 KB Output is correct
20 Correct 1623 ms 8204 KB Output is correct
21 Execution timed out 3058 ms 5960 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 372 KB Output is correct
16 Correct 8 ms 344 KB Output is correct
17 Correct 13 ms 348 KB Output is correct
18 Correct 15 ms 344 KB Output is correct
19 Correct 354 ms 6304 KB Output is correct
20 Correct 378 ms 6160 KB Output is correct
21 Correct 409 ms 6232 KB Output is correct
22 Correct 344 ms 6228 KB Output is correct
23 Execution timed out 3046 ms 4360 KB Time limit exceeded
24 Halted 0 ms 0 KB -