#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ssort sort(s.begin(),s.end());
#define sreverse reverse(s.begin(),s.end());
#define sclear s.clear();
#define ssize s.size();
#define ld long double
#define F first
#define S second
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define sq(a) (a)*(a)
/*void fopn(string name){
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}*/
ll a,b,c,e,d,f,k,g,h,q[2000000],i,j,x,y,z,m,n,l,r,w,t,p,s,u,sum,ans,mod=1e18;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>m;
for(i=1;i<=n;i++)
{
cin>>q[i];
}
for(i=1;i<=m;i++)
{
cin>>l>>r>>k;
t=0; x=q[l];
for(j=l+1;j<=r;j++){
if(x>q[j]) t=max(t,x+q[j]);
x=max(x,q[j]);
}
if(k>=t) cout<<1<<endl;
else cout<<0<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
336 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 |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 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 |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
336 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 |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
9 ms |
340 KB |
Output is correct |
12 |
Correct |
12 ms |
468 KB |
Output is correct |
13 |
Correct |
11 ms |
468 KB |
Output is correct |
14 |
Correct |
18 ms |
520 KB |
Output is correct |
15 |
Correct |
17 ms |
468 KB |
Output is correct |
16 |
Correct |
23 ms |
468 KB |
Output is correct |
17 |
Correct |
15 ms |
464 KB |
Output is correct |
18 |
Correct |
21 ms |
424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3068 ms |
8140 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2686 ms |
1332 KB |
Output is correct |
2 |
Execution timed out |
3080 ms |
2308 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
336 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 |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
9 ms |
340 KB |
Output is correct |
12 |
Correct |
12 ms |
468 KB |
Output is correct |
13 |
Correct |
11 ms |
468 KB |
Output is correct |
14 |
Correct |
18 ms |
520 KB |
Output is correct |
15 |
Correct |
17 ms |
468 KB |
Output is correct |
16 |
Correct |
23 ms |
468 KB |
Output is correct |
17 |
Correct |
15 ms |
464 KB |
Output is correct |
18 |
Correct |
21 ms |
424 KB |
Output is correct |
19 |
Execution timed out |
3046 ms |
3640 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
336 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 |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
9 ms |
340 KB |
Output is correct |
12 |
Correct |
12 ms |
468 KB |
Output is correct |
13 |
Correct |
11 ms |
468 KB |
Output is correct |
14 |
Correct |
18 ms |
520 KB |
Output is correct |
15 |
Correct |
17 ms |
468 KB |
Output is correct |
16 |
Correct |
23 ms |
468 KB |
Output is correct |
17 |
Correct |
15 ms |
464 KB |
Output is correct |
18 |
Correct |
21 ms |
424 KB |
Output is correct |
19 |
Execution timed out |
3068 ms |
8140 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |