#include <bits/stdc++.h>
using namespace std;
int n, m, a[5006];
int main()
{
cin>>n>>m;
for(int i = 0; i < n; i++){
cin>>a[i];
}
for(int i = 0; i < m; i++){
int l, r, s, mx, q = 0;
cin>>l>>r>>s;
mx = a[l];
for(int j = l + 1; j <= r; j++){
if(a[j] > mx){
mx = a[j];
}
else {
if(a[j] + mx > s){
cout<<0;
q = 1;
break;
}
}
}
if(q == 0)cout<<1;
cout<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
The output is neither -1 nor the length of the answer |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
The output is neither -1 nor the length of the answer |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
The output is neither -1 nor the length of the answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
The output is neither -1 nor the length of the answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
The output is neither -1 nor the length of the answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
368 KB |
The output is neither -1 nor the length of the answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
The output is neither -1 nor the length of the answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
The output is neither -1 nor the length of the answer |
2 |
Halted |
0 ms |
0 KB |
- |