#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
// pair - sort
//
void solve(int w[], int &n);
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
int w[n+1];
w[0] = 0;
for (int i=1; i<=n; i++) cin >> w[i];
for (int i=0; i<m; i++) solve(w, n);
return 0;
}
void solve(int w[], int &n)
{
int l, r, k;
cin >> l >> r >> k;
bool can = 1;
for (int i = l; can && i < r; i++)
for (int j = i+1; can && j <= r; j++)
if (w[i]>w[j] && w[i]+w[j]>k)
can = 0;
cout << can << 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 |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
2 ms |
332 KB |
Output is correct |
8 |
Correct |
22 ms |
204 KB |
Output is correct |
9 |
Correct |
8 ms |
204 KB |
Output is correct |
10 |
Correct |
10 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 |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
2 ms |
332 KB |
Output is correct |
8 |
Correct |
22 ms |
204 KB |
Output is correct |
9 |
Correct |
8 ms |
204 KB |
Output is correct |
10 |
Correct |
10 ms |
204 KB |
Output is correct |
11 |
Correct |
17 ms |
332 KB |
Output is correct |
12 |
Correct |
135 ms |
444 KB |
Output is correct |
13 |
Correct |
84 ms |
416 KB |
Output is correct |
14 |
Correct |
192 ms |
456 KB |
Output is correct |
15 |
Correct |
122 ms |
460 KB |
Output is correct |
16 |
Execution timed out |
3066 ms |
332 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
444 ms |
10232 KB |
Output is correct |
2 |
Correct |
443 ms |
10304 KB |
Output is correct |
3 |
Correct |
490 ms |
39008 KB |
Output is correct |
4 |
Correct |
464 ms |
39204 KB |
Output is correct |
5 |
Execution timed out |
3036 ms |
14176 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3013 ms |
1220 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 |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
2 ms |
332 KB |
Output is correct |
8 |
Correct |
22 ms |
204 KB |
Output is correct |
9 |
Correct |
8 ms |
204 KB |
Output is correct |
10 |
Correct |
10 ms |
204 KB |
Output is correct |
11 |
Correct |
17 ms |
332 KB |
Output is correct |
12 |
Correct |
135 ms |
444 KB |
Output is correct |
13 |
Correct |
84 ms |
416 KB |
Output is correct |
14 |
Correct |
192 ms |
456 KB |
Output is correct |
15 |
Correct |
122 ms |
460 KB |
Output is correct |
16 |
Execution timed out |
3066 ms |
332 KB |
Time limit exceeded |
17 |
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 |
1 ms |
320 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
320 KB |
Output is correct |
7 |
Correct |
2 ms |
332 KB |
Output is correct |
8 |
Correct |
22 ms |
204 KB |
Output is correct |
9 |
Correct |
8 ms |
204 KB |
Output is correct |
10 |
Correct |
10 ms |
204 KB |
Output is correct |
11 |
Correct |
17 ms |
332 KB |
Output is correct |
12 |
Correct |
135 ms |
444 KB |
Output is correct |
13 |
Correct |
84 ms |
416 KB |
Output is correct |
14 |
Correct |
192 ms |
456 KB |
Output is correct |
15 |
Correct |
122 ms |
460 KB |
Output is correct |
16 |
Execution timed out |
3066 ms |
332 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |