#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(b<a[e]){
if(b+mx>ki)
break;
mx = 0;
if(e!=ri && a[e]>a[e+1]){
y=1; b=a[e];
if(b>ki)
break; }
}
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 |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
3 ms |
332 KB |
Output is correct |
13 |
Correct |
3 ms |
336 KB |
Output is correct |
14 |
Correct |
3 ms |
332 KB |
Output is correct |
15 |
Correct |
3 ms |
332 KB |
Output is correct |
16 |
Correct |
18 ms |
332 KB |
Output is correct |
17 |
Correct |
19 ms |
356 KB |
Output is correct |
18 |
Correct |
21 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
512 ms |
10020 KB |
Output is correct |
2 |
Correct |
536 ms |
10024 KB |
Output is correct |
3 |
Correct |
530 ms |
10176 KB |
Output is correct |
4 |
Correct |
508 ms |
10052 KB |
Output is correct |
5 |
Execution timed out |
3058 ms |
8116 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
821 ms |
1212 KB |
Output is correct |
2 |
Correct |
2701 ms |
1484 KB |
Output is correct |
3 |
Execution timed out |
3064 ms |
1220 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
3 ms |
332 KB |
Output is correct |
13 |
Correct |
3 ms |
336 KB |
Output is correct |
14 |
Correct |
3 ms |
332 KB |
Output is correct |
15 |
Correct |
3 ms |
332 KB |
Output is correct |
16 |
Correct |
18 ms |
332 KB |
Output is correct |
17 |
Correct |
19 ms |
356 KB |
Output is correct |
18 |
Correct |
21 ms |
344 KB |
Output is correct |
19 |
Correct |
2628 ms |
2488 KB |
Output is correct |
20 |
Correct |
2595 ms |
2256 KB |
Output is correct |
21 |
Execution timed out |
3082 ms |
2164 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
3 ms |
332 KB |
Output is correct |
13 |
Correct |
3 ms |
336 KB |
Output is correct |
14 |
Correct |
3 ms |
332 KB |
Output is correct |
15 |
Correct |
3 ms |
332 KB |
Output is correct |
16 |
Correct |
18 ms |
332 KB |
Output is correct |
17 |
Correct |
19 ms |
356 KB |
Output is correct |
18 |
Correct |
21 ms |
344 KB |
Output is correct |
19 |
Correct |
512 ms |
10020 KB |
Output is correct |
20 |
Correct |
536 ms |
10024 KB |
Output is correct |
21 |
Correct |
530 ms |
10176 KB |
Output is correct |
22 |
Correct |
508 ms |
10052 KB |
Output is correct |
23 |
Execution timed out |
3058 ms |
8116 KB |
Time limit exceeded |