#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll wej[1000003];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n,m;
cin >> n >> m;
for (ll i = 1; i<=n; i++){
cin >> wej[i];
}
for (ll i = 1,a,b,c; i<=m; i++){
cin >> a >> b >> c;
ll mx=0;
for (ll j = a; j<=b; j++){
for (ll u = j; u<=b; u++){
if (wej[j]>wej[u])mx=max(mx,wej[j]+wej[u]);
}
}
if (c>=mx)cout << "1\n";
else cout << "0\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
12 ms |
480 KB |
Output is correct |
7 |
Correct |
12 ms |
348 KB |
Output is correct |
8 |
Correct |
16 ms |
480 KB |
Output is correct |
9 |
Correct |
5 ms |
348 KB |
Output is correct |
10 |
Correct |
14 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
12 ms |
480 KB |
Output is correct |
7 |
Correct |
12 ms |
348 KB |
Output is correct |
8 |
Correct |
16 ms |
480 KB |
Output is correct |
9 |
Correct |
5 ms |
348 KB |
Output is correct |
10 |
Correct |
14 ms |
348 KB |
Output is correct |
11 |
Correct |
599 ms |
512 KB |
Output is correct |
12 |
Execution timed out |
3045 ms |
348 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3020 ms |
8016 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3033 ms |
1112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
12 ms |
480 KB |
Output is correct |
7 |
Correct |
12 ms |
348 KB |
Output is correct |
8 |
Correct |
16 ms |
480 KB |
Output is correct |
9 |
Correct |
5 ms |
348 KB |
Output is correct |
10 |
Correct |
14 ms |
348 KB |
Output is correct |
11 |
Correct |
599 ms |
512 KB |
Output is correct |
12 |
Execution timed out |
3045 ms |
348 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
12 ms |
480 KB |
Output is correct |
7 |
Correct |
12 ms |
348 KB |
Output is correct |
8 |
Correct |
16 ms |
480 KB |
Output is correct |
9 |
Correct |
5 ms |
348 KB |
Output is correct |
10 |
Correct |
14 ms |
348 KB |
Output is correct |
11 |
Correct |
599 ms |
512 KB |
Output is correct |
12 |
Execution timed out |
3045 ms |
348 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |