Submission #1063216

# Submission time Handle Problem Language Result Execution time Memory
1063216 2024-08-17T15:21:51 Z manhlinh1501 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 14416 KB
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int MAXN = 1e6 + 5;

int N, Q;
int a[MAXN];

signed main() {
#define TASK "code"

    if (fopen(TASK ".inp", "r")) {
        freopen(TASK ".inp", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> N >> Q;
    for(int i = 1; i <= N; i++) cin >> a[i];
    while(Q--) {
        int l, r, x;
        cin >> l >> r >> x;
        int res = 0;
        bool ok = true;
        for(int i = l; i <= r; i++) {
            if(res > a[i] and res + a[i] > x)
                ok = false;
            res = max(res, a[i]);
        }
        cout << ok << "\n";
    }
    return (0 ^ 0);
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen(TASK ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen(TASK ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# 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 0 ms 476 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 0 ms 476 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 480 KB Output is correct
12 Correct 4 ms 588 KB Output is correct
13 Correct 4 ms 604 KB Output is correct
14 Correct 7 ms 636 KB Output is correct
15 Correct 7 ms 600 KB Output is correct
16 Correct 12 ms 608 KB Output is correct
17 Correct 10 ms 584 KB Output is correct
18 Correct 12 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3006 ms 14416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1588 ms 4852 KB Output is correct
2 Execution timed out 3078 ms 4080 KB Time limit exceeded
3 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 0 ms 476 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 480 KB Output is correct
12 Correct 4 ms 588 KB Output is correct
13 Correct 4 ms 604 KB Output is correct
14 Correct 7 ms 636 KB Output is correct
15 Correct 7 ms 600 KB Output is correct
16 Correct 12 ms 608 KB Output is correct
17 Correct 10 ms 584 KB Output is correct
18 Correct 12 ms 348 KB Output is correct
19 Execution timed out 3064 ms 7252 KB Time limit exceeded
20 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 0 ms 476 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 480 KB Output is correct
12 Correct 4 ms 588 KB Output is correct
13 Correct 4 ms 604 KB Output is correct
14 Correct 7 ms 636 KB Output is correct
15 Correct 7 ms 600 KB Output is correct
16 Correct 12 ms 608 KB Output is correct
17 Correct 10 ms 584 KB Output is correct
18 Correct 12 ms 348 KB Output is correct
19 Execution timed out 3006 ms 14416 KB Time limit exceeded
20 Halted 0 ms 0 KB -