#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
int a[n + 2];
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
while (m--) {
int l, r, k;
cin >> l >> r >> k;
bool is = 1;
for (int i = l; i <= r && is; i++) {
for (int j = i + 1; j <= r && is; j++) {
if (a[i] > a[j] && a[i] + a[j] > k) is = 0;
}
}
cout << is << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
25 ms |
468 KB |
Output is correct |
9 |
Correct |
8 ms |
348 KB |
Output is correct |
10 |
Correct |
12 ms |
464 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
25 ms |
468 KB |
Output is correct |
9 |
Correct |
8 ms |
348 KB |
Output is correct |
10 |
Correct |
12 ms |
464 KB |
Output is correct |
11 |
Correct |
16 ms |
348 KB |
Output is correct |
12 |
Correct |
140 ms |
600 KB |
Output is correct |
13 |
Correct |
85 ms |
348 KB |
Output is correct |
14 |
Correct |
194 ms |
616 KB |
Output is correct |
15 |
Correct |
122 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3055 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
384 ms |
34460 KB |
Output is correct |
2 |
Correct |
389 ms |
43292 KB |
Output is correct |
3 |
Correct |
373 ms |
42832 KB |
Output is correct |
4 |
Correct |
383 ms |
43044 KB |
Output is correct |
5 |
Execution timed out |
3046 ms |
18232 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3042 ms |
1628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
25 ms |
468 KB |
Output is correct |
9 |
Correct |
8 ms |
348 KB |
Output is correct |
10 |
Correct |
12 ms |
464 KB |
Output is correct |
11 |
Correct |
16 ms |
348 KB |
Output is correct |
12 |
Correct |
140 ms |
600 KB |
Output is correct |
13 |
Correct |
85 ms |
348 KB |
Output is correct |
14 |
Correct |
194 ms |
616 KB |
Output is correct |
15 |
Correct |
122 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3055 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
600 KB |
Output is correct |
5 |
Correct |
1 ms |
456 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
25 ms |
468 KB |
Output is correct |
9 |
Correct |
8 ms |
348 KB |
Output is correct |
10 |
Correct |
12 ms |
464 KB |
Output is correct |
11 |
Correct |
16 ms |
348 KB |
Output is correct |
12 |
Correct |
140 ms |
600 KB |
Output is correct |
13 |
Correct |
85 ms |
348 KB |
Output is correct |
14 |
Correct |
194 ms |
616 KB |
Output is correct |
15 |
Correct |
122 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3055 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |