#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<long long, long long> pll;
typedef pair<int,int> pii;
typedef vector<long long> vl;
typedef vector<int> vi;
int n, m;
vi arr;
int main(){
cin>>n>>m;
for(int i = 0; i < n; i++){
int a;
cin>>a;
arr.pb(a);
}
while(m--){
int l, r, k;
cin>>l>>r>>k;
l--; r--;
bool can = true;
int maxi = -1e9;
for(int i = l; i <= r; i++){
if(maxi > arr[i] && maxi + arr[i] > k){
can = false;
break;
}
maxi = max(maxi, arr[i]);
}
cout<<can<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
6 ms |
340 KB |
Output is correct |
12 |
Correct |
7 ms |
340 KB |
Output is correct |
13 |
Correct |
7 ms |
468 KB |
Output is correct |
14 |
Correct |
12 ms |
468 KB |
Output is correct |
15 |
Correct |
14 ms |
512 KB |
Output is correct |
16 |
Correct |
21 ms |
460 KB |
Output is correct |
17 |
Correct |
23 ms |
340 KB |
Output is correct |
18 |
Correct |
17 ms |
440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2117 ms |
28288 KB |
Output is correct |
2 |
Correct |
2142 ms |
39268 KB |
Output is correct |
3 |
Correct |
2193 ms |
39036 KB |
Output is correct |
4 |
Correct |
2507 ms |
39280 KB |
Output is correct |
5 |
Execution timed out |
3029 ms |
14464 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
680 ms |
2240 KB |
Output is correct |
2 |
Correct |
1821 ms |
2952 KB |
Output is correct |
3 |
Execution timed out |
3068 ms |
2588 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
6 ms |
340 KB |
Output is correct |
12 |
Correct |
7 ms |
340 KB |
Output is correct |
13 |
Correct |
7 ms |
468 KB |
Output is correct |
14 |
Correct |
12 ms |
468 KB |
Output is correct |
15 |
Correct |
14 ms |
512 KB |
Output is correct |
16 |
Correct |
21 ms |
460 KB |
Output is correct |
17 |
Correct |
23 ms |
340 KB |
Output is correct |
18 |
Correct |
17 ms |
440 KB |
Output is correct |
19 |
Correct |
2353 ms |
8196 KB |
Output is correct |
20 |
Correct |
2349 ms |
8104 KB |
Output is correct |
21 |
Execution timed out |
3055 ms |
5408 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
6 ms |
340 KB |
Output is correct |
12 |
Correct |
7 ms |
340 KB |
Output is correct |
13 |
Correct |
7 ms |
468 KB |
Output is correct |
14 |
Correct |
12 ms |
468 KB |
Output is correct |
15 |
Correct |
14 ms |
512 KB |
Output is correct |
16 |
Correct |
21 ms |
460 KB |
Output is correct |
17 |
Correct |
23 ms |
340 KB |
Output is correct |
18 |
Correct |
17 ms |
440 KB |
Output is correct |
19 |
Correct |
2117 ms |
28288 KB |
Output is correct |
20 |
Correct |
2142 ms |
39268 KB |
Output is correct |
21 |
Correct |
2193 ms |
39036 KB |
Output is correct |
22 |
Correct |
2507 ms |
39280 KB |
Output is correct |
23 |
Execution timed out |
3029 ms |
14464 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |