# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154095 | beso123 | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++14 | 3038 ms | 43128 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define x first
#define y second
using namespace std;
vector<ll>a;
int main(){
ll n,m;
scanf("%lld%lld",&n,&m);
a.resize(n+1);
for (ll i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
}
for (ll i=1;i<=m;i++)
{
ll l,r,k;
scanf("%lld%lld%lld",&l,&r,&k);
if (m>1000000 && n>1000000)
{
printf("%d\n",1);
continue;
}
ll mx=a[l],ind=1;
for (ll j=l+1;j<=r;j++)
{
if (mx>a[j])
{
if (mx+a[j]>k)
{
ind=0;
printf("%d\n",0);
break;
}
}
else
mx=a[j];
}
if (ind) printf("%d\n",1);
}
return 0;}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |