#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int n, q;
int a[maxn];
void solve(int l, int r, int k)
{
for (int j = l; j <= r; ++j)
{
for (int p = j + 1; p <= r; ++p)
{
if (a[j] > a[p] && a[j] + a[p] > k)
{
cout << 0 << "\n";
return;
}
}
}
cout << 1 << "\n";
}
void fastIO()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
{
fastIO();
cin >> n >> q;
for (int i = 1; i <= n; ++i)
{
cin >> a[i];
}
for (int i = 1; i <= q; ++i)
{
int l, r, k;
cin >> l >> r >> k;
solve(l, r, k);
}
return 0;
}
# |
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 |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
48 ms |
340 KB |
Output is correct |
9 |
Correct |
13 ms |
340 KB |
Output is correct |
10 |
Correct |
12 ms |
344 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 |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
48 ms |
340 KB |
Output is correct |
9 |
Correct |
13 ms |
340 KB |
Output is correct |
10 |
Correct |
12 ms |
344 KB |
Output is correct |
11 |
Correct |
16 ms |
344 KB |
Output is correct |
12 |
Correct |
134 ms |
436 KB |
Output is correct |
13 |
Correct |
98 ms |
468 KB |
Output is correct |
14 |
Correct |
213 ms |
476 KB |
Output is correct |
15 |
Correct |
130 ms |
496 KB |
Output is correct |
16 |
Execution timed out |
3070 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
430 ms |
27824 KB |
Output is correct |
2 |
Correct |
425 ms |
39044 KB |
Output is correct |
3 |
Correct |
414 ms |
39004 KB |
Output is correct |
4 |
Correct |
407 ms |
39156 KB |
Output is correct |
5 |
Execution timed out |
3055 ms |
14156 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3057 ms |
724 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 |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
48 ms |
340 KB |
Output is correct |
9 |
Correct |
13 ms |
340 KB |
Output is correct |
10 |
Correct |
12 ms |
344 KB |
Output is correct |
11 |
Correct |
16 ms |
344 KB |
Output is correct |
12 |
Correct |
134 ms |
436 KB |
Output is correct |
13 |
Correct |
98 ms |
468 KB |
Output is correct |
14 |
Correct |
213 ms |
476 KB |
Output is correct |
15 |
Correct |
130 ms |
496 KB |
Output is correct |
16 |
Execution timed out |
3070 ms |
340 KB |
Time limit exceeded |
17 |
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 |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
48 ms |
340 KB |
Output is correct |
9 |
Correct |
13 ms |
340 KB |
Output is correct |
10 |
Correct |
12 ms |
344 KB |
Output is correct |
11 |
Correct |
16 ms |
344 KB |
Output is correct |
12 |
Correct |
134 ms |
436 KB |
Output is correct |
13 |
Correct |
98 ms |
468 KB |
Output is correct |
14 |
Correct |
213 ms |
476 KB |
Output is correct |
15 |
Correct |
130 ms |
496 KB |
Output is correct |
16 |
Execution timed out |
3070 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |