#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, q;
cin >> n >> q;
vector<int> a(n);
for (auto &i : a)
cin >> i;
while (q--) {
int l, r, k;
cin >> l >> r >> k; l--; r--;
set<int> s;
bool tr = true;
for (int i = r; i >= l && tr; i--) {
tr = (s.empty() || a[i] <= *s.begin() || a[i] + *--lower_bound(s.begin(), s.end(), a[i]) <= k);
s.insert(a[i]);
}
cout << tr << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
46 ms |
464 KB |
Output is correct |
9 |
Correct |
7 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
46 ms |
464 KB |
Output is correct |
9 |
Correct |
7 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
25 ms |
348 KB |
Output is correct |
12 |
Correct |
141 ms |
604 KB |
Output is correct |
13 |
Correct |
109 ms |
656 KB |
Output is correct |
14 |
Correct |
304 ms |
604 KB |
Output is correct |
15 |
Correct |
104 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3017 ms |
600 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
374 ms |
35924 KB |
Output is correct |
2 |
Correct |
379 ms |
39100 KB |
Output is correct |
3 |
Correct |
376 ms |
38996 KB |
Output is correct |
4 |
Correct |
363 ms |
38992 KB |
Output is correct |
5 |
Execution timed out |
3022 ms |
58960 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3060 ms |
1372 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
46 ms |
464 KB |
Output is correct |
9 |
Correct |
7 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
25 ms |
348 KB |
Output is correct |
12 |
Correct |
141 ms |
604 KB |
Output is correct |
13 |
Correct |
109 ms |
656 KB |
Output is correct |
14 |
Correct |
304 ms |
604 KB |
Output is correct |
15 |
Correct |
104 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3017 ms |
600 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
2 ms |
348 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
46 ms |
464 KB |
Output is correct |
9 |
Correct |
7 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
25 ms |
348 KB |
Output is correct |
12 |
Correct |
141 ms |
604 KB |
Output is correct |
13 |
Correct |
109 ms |
656 KB |
Output is correct |
14 |
Correct |
304 ms |
604 KB |
Output is correct |
15 |
Correct |
104 ms |
604 KB |
Output is correct |
16 |
Execution timed out |
3017 ms |
600 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |