#include <bits/stdc++.h>
//#define int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
signed main() {
ios_base::sync_with_stdio(false);
cout.tie(0); cin.tie(0);
int n, q;
cin >> n >> q;
vector<int> v(n+1);
for(int i=1; i<=n; i++) cin >> v[i];
while(q--) {
int l, r, k;
cin >> l >> r >> k;
bool ok = 1;
for(int i=l; i<=r&&ok; i++)
for(int j=l; j<i&&ok; j++)
if(v[i] + v[j] > k && v[i] < v[j]) ok = 0;
cout << ok << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
27 ms |
344 KB |
Output is correct |
9 |
Correct |
9 ms |
348 KB |
Output is correct |
10 |
Correct |
9 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
27 ms |
344 KB |
Output is correct |
9 |
Correct |
9 ms |
348 KB |
Output is correct |
10 |
Correct |
9 ms |
460 KB |
Output is correct |
11 |
Correct |
4 ms |
348 KB |
Output is correct |
12 |
Correct |
15 ms |
580 KB |
Output is correct |
13 |
Correct |
16 ms |
588 KB |
Output is correct |
14 |
Correct |
31 ms |
604 KB |
Output is correct |
15 |
Correct |
13 ms |
472 KB |
Output is correct |
16 |
Execution timed out |
3022 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
359 ms |
6480 KB |
Output is correct |
2 |
Correct |
370 ms |
6184 KB |
Output is correct |
3 |
Correct |
340 ms |
6228 KB |
Output is correct |
4 |
Correct |
349 ms |
6152 KB |
Output is correct |
5 |
Execution timed out |
3063 ms |
4188 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3056 ms |
604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
27 ms |
344 KB |
Output is correct |
9 |
Correct |
9 ms |
348 KB |
Output is correct |
10 |
Correct |
9 ms |
460 KB |
Output is correct |
11 |
Correct |
4 ms |
348 KB |
Output is correct |
12 |
Correct |
15 ms |
580 KB |
Output is correct |
13 |
Correct |
16 ms |
588 KB |
Output is correct |
14 |
Correct |
31 ms |
604 KB |
Output is correct |
15 |
Correct |
13 ms |
472 KB |
Output is correct |
16 |
Execution timed out |
3022 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
27 ms |
344 KB |
Output is correct |
9 |
Correct |
9 ms |
348 KB |
Output is correct |
10 |
Correct |
9 ms |
460 KB |
Output is correct |
11 |
Correct |
4 ms |
348 KB |
Output is correct |
12 |
Correct |
15 ms |
580 KB |
Output is correct |
13 |
Correct |
16 ms |
588 KB |
Output is correct |
14 |
Correct |
31 ms |
604 KB |
Output is correct |
15 |
Correct |
13 ms |
472 KB |
Output is correct |
16 |
Execution timed out |
3022 ms |
348 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |