Submission #952766

# Submission time Handle Problem Language Result Execution time Memory
952766 2024-03-24T18:33:42 Z idiotcomputer Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++11
17 / 100
3000 ms 39144 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 1e6;
int n;
int vals[mxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int m;
    cin >> n >> m;
    
    for (int i =0; i < n; i++) cin >> vals[i];
    
    int l,r,k,cmax;
    bool work;
    for (int i = 0; i < m; i++){
        cin >> l >> r >> k;
        l -= 1;
        r -= 1;
        bool work = true;
        cmax = 0;
        for (int j = l; j <= r; j++){
            if (cmax > vals[j] && cmax+vals[j] > k){
                work = false;
                break;
            }
            cmax = max(cmax,vals[j]);
        }
        cout << work << '\n';
    }
    return 0;
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:19:10: warning: unused variable 'work' [-Wunused-variable]
   19 |     bool work;
      |          ^~~~
# 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 856 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 440 KB Output is correct
9 Correct 1 ms 500 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 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 856 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 440 KB Output is correct
9 Correct 1 ms 500 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 484 KB Output is correct
16 Correct 11 ms 604 KB Output is correct
17 Correct 12 ms 580 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 358 ms 14376 KB Output is correct
2 Correct 337 ms 39092 KB Output is correct
3 Correct 346 ms 38884 KB Output is correct
4 Correct 376 ms 39144 KB Output is correct
5 Execution timed out 3027 ms 14456 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 526 ms 2896 KB Output is correct
2 Correct 1617 ms 4816 KB Output is correct
3 Execution timed out 3054 ms 4312 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 856 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 440 KB Output is correct
9 Correct 1 ms 500 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 484 KB Output is correct
16 Correct 11 ms 604 KB Output is correct
17 Correct 12 ms 580 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
19 Correct 1941 ms 9736 KB Output is correct
20 Correct 1915 ms 9768 KB Output is correct
21 Execution timed out 3020 ms 7832 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 856 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 440 KB Output is correct
9 Correct 1 ms 500 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 2 ms 604 KB Output is correct
15 Correct 2 ms 484 KB Output is correct
16 Correct 11 ms 604 KB Output is correct
17 Correct 12 ms 580 KB Output is correct
18 Correct 10 ms 348 KB Output is correct
19 Correct 358 ms 14376 KB Output is correct
20 Correct 337 ms 39092 KB Output is correct
21 Correct 346 ms 38884 KB Output is correct
22 Correct 376 ms 39144 KB Output is correct
23 Execution timed out 3027 ms 14456 KB Time limit exceeded
24 Halted 0 ms 0 KB -