#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int w[n];
for (int i=0; i<n; i++)
cin >> w[i];
while (m--)
{
int l, r, k, x, y=1;
cin >> l >> r >> k;
x = w[l-1];
for (int i=l; i<r; i++)
{
if (x > w[i] && x + w[i] > k)
{
y = 0;
break;
}
else if (x < w[i]) x = w[i];
}
cout << y << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
224 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
224 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
9 ms |
340 KB |
Output is correct |
12 |
Correct |
8 ms |
340 KB |
Output is correct |
13 |
Correct |
8 ms |
312 KB |
Output is correct |
14 |
Correct |
12 ms |
440 KB |
Output is correct |
15 |
Correct |
13 ms |
464 KB |
Output is correct |
16 |
Correct |
21 ms |
340 KB |
Output is correct |
17 |
Correct |
22 ms |
340 KB |
Output is correct |
18 |
Correct |
20 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2442 ms |
8060 KB |
Output is correct |
2 |
Correct |
2507 ms |
38964 KB |
Output is correct |
3 |
Correct |
2535 ms |
38928 KB |
Output is correct |
4 |
Correct |
2533 ms |
22272 KB |
Output is correct |
5 |
Execution timed out |
3057 ms |
14416 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
781 ms |
1268 KB |
Output is correct |
2 |
Correct |
2185 ms |
3044 KB |
Output is correct |
3 |
Execution timed out |
3071 ms |
2664 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
224 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
9 ms |
340 KB |
Output is correct |
12 |
Correct |
8 ms |
340 KB |
Output is correct |
13 |
Correct |
8 ms |
312 KB |
Output is correct |
14 |
Correct |
12 ms |
440 KB |
Output is correct |
15 |
Correct |
13 ms |
464 KB |
Output is correct |
16 |
Correct |
21 ms |
340 KB |
Output is correct |
17 |
Correct |
22 ms |
340 KB |
Output is correct |
18 |
Correct |
20 ms |
340 KB |
Output is correct |
19 |
Correct |
2733 ms |
8184 KB |
Output is correct |
20 |
Correct |
2742 ms |
8092 KB |
Output is correct |
21 |
Execution timed out |
3058 ms |
5204 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
224 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
9 ms |
340 KB |
Output is correct |
12 |
Correct |
8 ms |
340 KB |
Output is correct |
13 |
Correct |
8 ms |
312 KB |
Output is correct |
14 |
Correct |
12 ms |
440 KB |
Output is correct |
15 |
Correct |
13 ms |
464 KB |
Output is correct |
16 |
Correct |
21 ms |
340 KB |
Output is correct |
17 |
Correct |
22 ms |
340 KB |
Output is correct |
18 |
Correct |
20 ms |
340 KB |
Output is correct |
19 |
Correct |
2442 ms |
8060 KB |
Output is correct |
20 |
Correct |
2507 ms |
38964 KB |
Output is correct |
21 |
Correct |
2535 ms |
38928 KB |
Output is correct |
22 |
Correct |
2533 ms |
22272 KB |
Output is correct |
23 |
Execution timed out |
3057 ms |
14416 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |