#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
long long int w[n+1];
w[0] = 0;
for (int i = 1; i <=n; i++)
cin >> w[i];
for (int i = 0; i < m; i++)
{
int l, r, k;
cin >> l >> r >> k;
long long int sum = 0;
for (int i=l; i<r; i++)
for (int j=i+1; j<=r; j++)
if (w[i]>w[j])
sum = max( sum, (w[i]+w[j]) );
cout << (sum<=k?1:0) << endl;}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
23 ms |
204 KB |
Output is correct |
7 |
Correct |
24 ms |
332 KB |
Output is correct |
8 |
Correct |
32 ms |
204 KB |
Output is correct |
9 |
Correct |
9 ms |
320 KB |
Output is correct |
10 |
Correct |
27 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
23 ms |
204 KB |
Output is correct |
7 |
Correct |
24 ms |
332 KB |
Output is correct |
8 |
Correct |
32 ms |
204 KB |
Output is correct |
9 |
Correct |
9 ms |
320 KB |
Output is correct |
10 |
Correct |
27 ms |
204 KB |
Output is correct |
11 |
Correct |
1156 ms |
372 KB |
Output is correct |
12 |
Execution timed out |
3076 ms |
332 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3036 ms |
8012 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3077 ms |
972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
23 ms |
204 KB |
Output is correct |
7 |
Correct |
24 ms |
332 KB |
Output is correct |
8 |
Correct |
32 ms |
204 KB |
Output is correct |
9 |
Correct |
9 ms |
320 KB |
Output is correct |
10 |
Correct |
27 ms |
204 KB |
Output is correct |
11 |
Correct |
1156 ms |
372 KB |
Output is correct |
12 |
Execution timed out |
3076 ms |
332 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
23 ms |
204 KB |
Output is correct |
7 |
Correct |
24 ms |
332 KB |
Output is correct |
8 |
Correct |
32 ms |
204 KB |
Output is correct |
9 |
Correct |
9 ms |
320 KB |
Output is correct |
10 |
Correct |
27 ms |
204 KB |
Output is correct |
11 |
Correct |
1156 ms |
372 KB |
Output is correct |
12 |
Execution timed out |
3076 ms |
332 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |