#include<bits/stdc++.h>
#define loop(n) for(int i=0; i<n; i++)
#define ll long long
#define ld long double
#define ull unsigned long long
#define ff first
#define ss second
#define p_b push_back
#define l_b lower_bound
#define u_b upper_bound
#define m_p make_pair
#define m_t make_tuple
#define ar array
using namespace std;
const int M=1e9, mxN=1e5;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);
//cout.tie(NULL);
int n, m;
cin>>n>>m;
int w[n];
for(int i=0; i<n; i++){
cin>>w[i];
}
while(m--){
int l, r, k;
cin>>l>>r>>k;
l--; r--;
int ans=0;
for(int i=l; i<=r; i++){
for(int j=i+1; j<=r; j++){
if(w[i]>w[j]){
ans=max(ans, w[i]+w[j]);
}
}
}
// cout<<ans<<endl;
ans>k? cout<<0: cout<<1;
cout<<'\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
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 |
26 ms |
328 KB |
Output is correct |
7 |
Correct |
25 ms |
204 KB |
Output is correct |
8 |
Correct |
34 ms |
204 KB |
Output is correct |
9 |
Correct |
10 ms |
316 KB |
Output is correct |
10 |
Correct |
27 ms |
296 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
26 ms |
328 KB |
Output is correct |
7 |
Correct |
25 ms |
204 KB |
Output is correct |
8 |
Correct |
34 ms |
204 KB |
Output is correct |
9 |
Correct |
10 ms |
316 KB |
Output is correct |
10 |
Correct |
27 ms |
296 KB |
Output is correct |
11 |
Correct |
1253 ms |
372 KB |
Output is correct |
12 |
Execution timed out |
3062 ms |
332 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3071 ms |
6964 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3085 ms |
1228 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
26 ms |
328 KB |
Output is correct |
7 |
Correct |
25 ms |
204 KB |
Output is correct |
8 |
Correct |
34 ms |
204 KB |
Output is correct |
9 |
Correct |
10 ms |
316 KB |
Output is correct |
10 |
Correct |
27 ms |
296 KB |
Output is correct |
11 |
Correct |
1253 ms |
372 KB |
Output is correct |
12 |
Execution timed out |
3062 ms |
332 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
26 ms |
328 KB |
Output is correct |
7 |
Correct |
25 ms |
204 KB |
Output is correct |
8 |
Correct |
34 ms |
204 KB |
Output is correct |
9 |
Correct |
10 ms |
316 KB |
Output is correct |
10 |
Correct |
27 ms |
296 KB |
Output is correct |
11 |
Correct |
1253 ms |
372 KB |
Output is correct |
12 |
Execution timed out |
3062 ms |
332 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |