#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], mn=INT_MAX;
for(int i=0; i<n; i++){
cin>>w[i];
mn=min(mn, w[i]);
}
while(m--){
int l, r, k;
cin>>l>>r>>k;
l--; r--;
int ans=0;
if(k<mn){
for(int i=l; i<r; i++){
if(w[l]>w[r]){
ans=1;
break;
}
}
ans? cout<<0: cout<<1;
cout<<'\n';
continue;
}
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]);
}
}
}
ans>k? cout<<0: cout<<1;
cout<<'\n';
}
}
# |
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 |
3 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 |
Incorrect |
27 ms |
320 KB |
Output isn't correct |
7 |
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 |
3 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 |
Incorrect |
27 ms |
320 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3067 ms |
4548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3060 ms |
716 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 |
3 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 |
Incorrect |
27 ms |
320 KB |
Output isn't correct |
7 |
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 |
3 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 |
Incorrect |
27 ms |
320 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |