Submission #569661

# Submission time Handle Problem Language Result Execution time Memory
569661 2022-05-27T15:23:41 Z SSRS Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 4628 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> w(N);
  for (int i = 0; i < N; i++){
    cin >> w[i];
  }
  for (int i = 0; i < M; i++){
    int l, r, k;
    cin >> l >> r >> k;
    l--;
    int mx1 = -1, mx2 = 0;
    for (int j = l; j < r; j++){
      if (w[j] >= mx1){
        mx1 = w[j];
      } else {
        mx2 = max(mx2, mx1 + w[j]);
      }
    }
    if (mx2 <= k){
      cout << 1 << endl;
    } else {
      cout << 0 << endl;
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 8 ms 212 KB Output is correct
12 Correct 13 ms 324 KB Output is correct
13 Correct 14 ms 428 KB Output is correct
14 Correct 22 ms 472 KB Output is correct
15 Correct 23 ms 476 KB Output is correct
16 Correct 25 ms 412 KB Output is correct
17 Correct 18 ms 420 KB Output is correct
18 Correct 24 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 4328 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2794 ms 1016 KB Output is correct
2 Execution timed out 3087 ms 1872 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 8 ms 212 KB Output is correct
12 Correct 13 ms 324 KB Output is correct
13 Correct 14 ms 428 KB Output is correct
14 Correct 22 ms 472 KB Output is correct
15 Correct 23 ms 476 KB Output is correct
16 Correct 25 ms 412 KB Output is correct
17 Correct 18 ms 420 KB Output is correct
18 Correct 24 ms 400 KB Output is correct
19 Execution timed out 3070 ms 4628 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 8 ms 212 KB Output is correct
12 Correct 13 ms 324 KB Output is correct
13 Correct 14 ms 428 KB Output is correct
14 Correct 22 ms 472 KB Output is correct
15 Correct 23 ms 476 KB Output is correct
16 Correct 25 ms 412 KB Output is correct
17 Correct 18 ms 420 KB Output is correct
18 Correct 24 ms 400 KB Output is correct
19 Execution timed out 3073 ms 4328 KB Time limit exceeded
20 Halted 0 ms 0 KB -