#include "bits/stdc++.h"
#define F first
#define S second
#define ALL(a) a.begin() , a.end()
#ifndef ONLINE_JUDGE
#define OK cout << __LINE__ << "| "<< "---------------------------OK-----------------------" << endl;
#define deb(x) cout << __LINE__ << "| "<< #x << " = " << x << endl;
#else
#define OK
#define deb(x)
#endif
typedef long double ld;
typedef long long ll;
using namespace std ;
const ll N = 2e5 ;
const ll INF = 1e9;
const ll mod = 1e9 + 7 ;
const double eps = 1e-9 ;
const int dx[] = { 0 , 0 , 1 , -1, 1 , -1 , 1 , -1} , dy[] = {1 , -1 , 0 , 0 , 1 , 1, -1 , -1} ;
int n , q, a[N] ;
vector<pair<int,int > > vec;
void test_solve(int test_index){
cin >> n >> q;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int query = 1; query <= q ; query++){
int l , r , k , ans = 1;
cin >> l >> r >> k;
for(int i = l; i<=r and ans ; i++){
for(int j = l; j < i ;j++){
if(a[j] > a[i] and a[j] + a[i] > k){
ans = 0;
break;
}
}
}
cout << ans << endl;
}
}
signed main(){
ios_base::sync_with_stdio(false) ;
cin.tie(0) ;
cout.tie(0);
int test = 1;
//cin >> test ;
for(int i = 1 ; i <= test ; i++){
// cout << "Case " << i << ": " ;
test_solve(i) ;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
17 ms |
348 KB |
Output is correct |
9 |
Correct |
6 ms |
440 KB |
Output is correct |
10 |
Correct |
7 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
17 ms |
348 KB |
Output is correct |
9 |
Correct |
6 ms |
440 KB |
Output is correct |
10 |
Correct |
7 ms |
348 KB |
Output is correct |
11 |
Correct |
9 ms |
344 KB |
Output is correct |
12 |
Correct |
40 ms |
344 KB |
Output is correct |
13 |
Correct |
32 ms |
344 KB |
Output is correct |
14 |
Correct |
80 ms |
620 KB |
Output is correct |
15 |
Correct |
26 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3057 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
2140 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3018 ms |
1064 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
17 ms |
348 KB |
Output is correct |
9 |
Correct |
6 ms |
440 KB |
Output is correct |
10 |
Correct |
7 ms |
348 KB |
Output is correct |
11 |
Correct |
9 ms |
344 KB |
Output is correct |
12 |
Correct |
40 ms |
344 KB |
Output is correct |
13 |
Correct |
32 ms |
344 KB |
Output is correct |
14 |
Correct |
80 ms |
620 KB |
Output is correct |
15 |
Correct |
26 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3057 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
17 ms |
348 KB |
Output is correct |
9 |
Correct |
6 ms |
440 KB |
Output is correct |
10 |
Correct |
7 ms |
348 KB |
Output is correct |
11 |
Correct |
9 ms |
344 KB |
Output is correct |
12 |
Correct |
40 ms |
344 KB |
Output is correct |
13 |
Correct |
32 ms |
344 KB |
Output is correct |
14 |
Correct |
80 ms |
620 KB |
Output is correct |
15 |
Correct |
26 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3057 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |