#include <bits/stdc++.h>
#define N 200005
using namespace std;
int a[N];
void solve(){
int n,m;
cin >> n >> m;
for(int i = 1;i<=n;i++){
cin >> a[i];
}
for(int i =1;i<=m;i++){
int l,r,k;
cin >> l >> r >> k;
int maxi = 0;
for(int j = l;j<=r;j++){
for(int c = j+1;c<=r;c++){
if(a[c] >= a[j])break;
maxi = max(maxi,a[j] + a[c]);
}
}
cout << (maxi <= k) << '\n';
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#ifdef Local
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif
int t=1;
//cin>>t;
while(t--){
solve();
}
#ifdef Local
cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
#endif
}
# |
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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
340 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
16 ms |
412 KB |
Output is correct |
12 |
Correct |
52 ms |
428 KB |
Output is correct |
13 |
Correct |
59 ms |
340 KB |
Output is correct |
14 |
Correct |
102 ms |
476 KB |
Output is correct |
15 |
Correct |
104 ms |
468 KB |
Output is correct |
16 |
Correct |
88 ms |
460 KB |
Output is correct |
17 |
Correct |
14 ms |
448 KB |
Output is correct |
18 |
Correct |
28 ms |
540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
2164 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3049 ms |
972 KB |
Time limit exceeded |
2 |
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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
16 ms |
412 KB |
Output is correct |
12 |
Correct |
52 ms |
428 KB |
Output is correct |
13 |
Correct |
59 ms |
340 KB |
Output is correct |
14 |
Correct |
102 ms |
476 KB |
Output is correct |
15 |
Correct |
104 ms |
468 KB |
Output is correct |
16 |
Correct |
88 ms |
460 KB |
Output is correct |
17 |
Correct |
14 ms |
448 KB |
Output is correct |
18 |
Correct |
28 ms |
540 KB |
Output is correct |
19 |
Execution timed out |
3064 ms |
3248 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
16 ms |
412 KB |
Output is correct |
12 |
Correct |
52 ms |
428 KB |
Output is correct |
13 |
Correct |
59 ms |
340 KB |
Output is correct |
14 |
Correct |
102 ms |
476 KB |
Output is correct |
15 |
Correct |
104 ms |
468 KB |
Output is correct |
16 |
Correct |
88 ms |
460 KB |
Output is correct |
17 |
Correct |
14 ms |
448 KB |
Output is correct |
18 |
Correct |
28 ms |
540 KB |
Output is correct |
19 |
Runtime error |
27 ms |
2164 KB |
Execution killed with signal 11 |
20 |
Halted |
0 ms |
0 KB |
- |