#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n, m;
cin >> n >> m;
long long a[n+1], b, mx=0, li, ri, ki;
for(int i=1; i<=n; i++)
cin >> a[i];
for(int i=1; i<=m; i++){
bool y=0;
b = 0;
cin >> li >> ri >> ki;
for(int e=li; e<=ri; e++){
if(e!=ri && y==0 && a[e]>a[e+1]){
y=1; b=a[e]; }
if(y && a[e]<b)
mx = max(a[e], mx);
}
//cout << b << ' ' << mx << "\n";
if(b+mx>ki)
cout << 0 << "\n";
else
cout << 1 << "\n";
mx = 0;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Incorrect |
1 ms |
244 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Incorrect |
1 ms |
244 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3066 ms |
8484 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3046 ms |
1428 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Incorrect |
1 ms |
244 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
312 KB |
Output is correct |
3 |
Incorrect |
1 ms |
244 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |