Submission #950239

# Submission time Handle Problem Language Result Execution time Memory
950239 2024-03-20T07:11:34 Z nguyennh Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
8 / 100
87 ms 14148 KB
#include<bits/stdc++.h>
#define el '\n'
using namespace std ;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

const int MN = 1e6 + 5;

int n , m , a[MN];

namespace sub_trau{
  bool valid_input(){
    return n <= 500 && m <= 500;
  }
  
  void solve(){
    while(m--){
      int l , r , k;
      cin >> l >> r >> k;
      int ans = 0;
      for ( int i = l ; i <= r ; i++ ){
        for ( int j = i ; j <= r ; j++ ){
          if (a[j] < a[i]) ans = max(ans , a[j] + a[i]);
        }
      }
      cout << (ans <= k ? 1 : 0) << el;
    }
  }
}

int32_t main (){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for ( int i = 1 ; i <= n ; i++ ) cin >> a[i];
  if (sub_trau::valid_input()){
    sub_trau::solve();
    return 0;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 472 KB Output is correct
6 Correct 29 ms 348 KB Output is correct
7 Correct 28 ms 348 KB Output is correct
8 Correct 31 ms 456 KB Output is correct
9 Correct 9 ms 348 KB Output is correct
10 Correct 28 ms 480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 472 KB Output is correct
6 Correct 29 ms 348 KB Output is correct
7 Correct 28 ms 348 KB Output is correct
8 Correct 31 ms 456 KB Output is correct
9 Correct 9 ms 348 KB Output is correct
10 Correct 28 ms 480 KB Output is correct
11 Incorrect 1 ms 352 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 14148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 3132 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 472 KB Output is correct
6 Correct 29 ms 348 KB Output is correct
7 Correct 28 ms 348 KB Output is correct
8 Correct 31 ms 456 KB Output is correct
9 Correct 9 ms 348 KB Output is correct
10 Correct 28 ms 480 KB Output is correct
11 Incorrect 1 ms 352 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 472 KB Output is correct
6 Correct 29 ms 348 KB Output is correct
7 Correct 28 ms 348 KB Output is correct
8 Correct 31 ms 456 KB Output is correct
9 Correct 9 ms 348 KB Output is correct
10 Correct 28 ms 480 KB Output is correct
11 Incorrect 1 ms 352 KB Output isn't correct
12 Halted 0 ms 0 KB -