#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t[1000000];
void solve()
{
int l,r,k;ll m=0;
cin>>l>>r>>k;
l--;r--;
for(int c=l;c<=r;c++)
{
if(t[c]<m)
{
if(t[c]+m>k&&c>0)
{
cout<<"0\n";return;
}
}
else
{
m=t[c];
}
}
cout<<"1\n";
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n,m;
cin>>n>>m;
for(int c=0;c<n;c++)
{
cin>>t[c];
}
while(m--)
{
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
2 ms |
460 KB |
Output is correct |
13 |
Correct |
2 ms |
428 KB |
Output is correct |
14 |
Correct |
4 ms |
432 KB |
Output is correct |
15 |
Correct |
3 ms |
460 KB |
Output is correct |
16 |
Correct |
10 ms |
476 KB |
Output is correct |
17 |
Correct |
11 ms |
456 KB |
Output is correct |
18 |
Correct |
8 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
465 ms |
10232 KB |
Output is correct |
2 |
Correct |
498 ms |
13036 KB |
Output is correct |
3 |
Correct |
534 ms |
13220 KB |
Output is correct |
4 |
Correct |
475 ms |
13136 KB |
Output is correct |
5 |
Execution timed out |
3036 ms |
11400 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
416 ms |
1420 KB |
Output is correct |
2 |
Correct |
1318 ms |
3244 KB |
Output is correct |
3 |
Execution timed out |
3051 ms |
3292 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
2 ms |
460 KB |
Output is correct |
13 |
Correct |
2 ms |
428 KB |
Output is correct |
14 |
Correct |
4 ms |
432 KB |
Output is correct |
15 |
Correct |
3 ms |
460 KB |
Output is correct |
16 |
Correct |
10 ms |
476 KB |
Output is correct |
17 |
Correct |
11 ms |
456 KB |
Output is correct |
18 |
Correct |
8 ms |
332 KB |
Output is correct |
19 |
Correct |
1596 ms |
4204 KB |
Output is correct |
20 |
Correct |
1618 ms |
4148 KB |
Output is correct |
21 |
Execution timed out |
3033 ms |
5540 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
2 ms |
460 KB |
Output is correct |
13 |
Correct |
2 ms |
428 KB |
Output is correct |
14 |
Correct |
4 ms |
432 KB |
Output is correct |
15 |
Correct |
3 ms |
460 KB |
Output is correct |
16 |
Correct |
10 ms |
476 KB |
Output is correct |
17 |
Correct |
11 ms |
456 KB |
Output is correct |
18 |
Correct |
8 ms |
332 KB |
Output is correct |
19 |
Correct |
465 ms |
10232 KB |
Output is correct |
20 |
Correct |
498 ms |
13036 KB |
Output is correct |
21 |
Correct |
534 ms |
13220 KB |
Output is correct |
22 |
Correct |
475 ms |
13136 KB |
Output is correct |
23 |
Execution timed out |
3036 ms |
11400 KB |
Time limit exceeded |