#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define sz size
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fre(s) freopen(s".in", "r", stdin);freopen(s".out", "w", stdout);
#define s second
#define f first
#define ii pair<ll,ll>
const ll mod=1e9+7;
const int N=2e5+6;
const ll inf=1e12+5;
ll n,l,r,m,k,d[N],g[N],mx=-N;
int main()
{
ios
cin>>n>>k;
for(int i=1;i<=n;++i)
{
cin>>d[i];
}
while(k--)
{
cin>>l>>r>>m;
ll x=d[l],cnt=0;
for(int i=l+1;i<=r;++i)
{
if(d[i]<x)
{
cnt=max(cnt,d[i]+x);
}
else x=d[i];
}
if(cnt<=m){
cout<<1<<"\n";
}
else cout<<0<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
4 ms |
2396 KB |
Output is correct |
12 |
Correct |
4 ms |
2396 KB |
Output is correct |
13 |
Correct |
5 ms |
2396 KB |
Output is correct |
14 |
Correct |
7 ms |
2516 KB |
Output is correct |
15 |
Correct |
8 ms |
2396 KB |
Output is correct |
16 |
Correct |
11 ms |
2396 KB |
Output is correct |
17 |
Correct |
7 ms |
2396 KB |
Output is correct |
18 |
Correct |
10 ms |
2516 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
20 ms |
6488 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1742 ms |
2644 KB |
Output is correct |
2 |
Execution timed out |
3050 ms |
3924 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
4 ms |
2396 KB |
Output is correct |
12 |
Correct |
4 ms |
2396 KB |
Output is correct |
13 |
Correct |
5 ms |
2396 KB |
Output is correct |
14 |
Correct |
7 ms |
2516 KB |
Output is correct |
15 |
Correct |
8 ms |
2396 KB |
Output is correct |
16 |
Correct |
11 ms |
2396 KB |
Output is correct |
17 |
Correct |
7 ms |
2396 KB |
Output is correct |
18 |
Correct |
10 ms |
2516 KB |
Output is correct |
19 |
Execution timed out |
3024 ms |
5236 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
4 ms |
2396 KB |
Output is correct |
12 |
Correct |
4 ms |
2396 KB |
Output is correct |
13 |
Correct |
5 ms |
2396 KB |
Output is correct |
14 |
Correct |
7 ms |
2516 KB |
Output is correct |
15 |
Correct |
8 ms |
2396 KB |
Output is correct |
16 |
Correct |
11 ms |
2396 KB |
Output is correct |
17 |
Correct |
7 ms |
2396 KB |
Output is correct |
18 |
Correct |
10 ms |
2516 KB |
Output is correct |
19 |
Runtime error |
20 ms |
6488 KB |
Execution killed with signal 11 |
20 |
Halted |
0 ms |
0 KB |
- |