#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN=1e6;
int n, m, w[mxN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i=0; i<n; ++i)
cin >> w[i];
for (int i=0; i<m; ++i) {
int l, r, k;
cin >> l >> r >> k, --l, --r;
int mx=0;
for (int a=l; a<=r; ++a)
for (int b=a+1; b<=r; ++b)
if (w[a]>w[b])
mx=max(mx, w[a]+w[b]);
cout << (mx<=k) << "\n";
}
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 |
4 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
27 ms |
340 KB |
Output is correct |
7 |
Correct |
26 ms |
340 KB |
Output is correct |
8 |
Correct |
33 ms |
212 KB |
Output is correct |
9 |
Correct |
9 ms |
340 KB |
Output is correct |
10 |
Correct |
26 ms |
212 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 |
4 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
27 ms |
340 KB |
Output is correct |
7 |
Correct |
26 ms |
340 KB |
Output is correct |
8 |
Correct |
33 ms |
212 KB |
Output is correct |
9 |
Correct |
9 ms |
340 KB |
Output is correct |
10 |
Correct |
26 ms |
212 KB |
Output is correct |
11 |
Correct |
1222 ms |
388 KB |
Output is correct |
12 |
Execution timed out |
3046 ms |
340 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3083 ms |
4092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3076 ms |
596 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 |
4 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
27 ms |
340 KB |
Output is correct |
7 |
Correct |
26 ms |
340 KB |
Output is correct |
8 |
Correct |
33 ms |
212 KB |
Output is correct |
9 |
Correct |
9 ms |
340 KB |
Output is correct |
10 |
Correct |
26 ms |
212 KB |
Output is correct |
11 |
Correct |
1222 ms |
388 KB |
Output is correct |
12 |
Execution timed out |
3046 ms |
340 KB |
Time limit exceeded |
13 |
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 |
4 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
212 KB |
Output is correct |
6 |
Correct |
27 ms |
340 KB |
Output is correct |
7 |
Correct |
26 ms |
340 KB |
Output is correct |
8 |
Correct |
33 ms |
212 KB |
Output is correct |
9 |
Correct |
9 ms |
340 KB |
Output is correct |
10 |
Correct |
26 ms |
212 KB |
Output is correct |
11 |
Correct |
1222 ms |
388 KB |
Output is correct |
12 |
Execution timed out |
3046 ms |
340 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |