| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 493182 | irmuun | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3065 ms | 6608 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>
using namespace std;
#define ll long long
int main(){
ll n,m,w[200001],h[200001],l,r,k,ans,i,j,b,c,mx=0;
cin>>n>>m;
for(i=1;i<=n;i++){
cin>>w[i];
mx=max(mx,w[i]);
h[i]=w[i];
}
for(i=1;i<=m;i++){
cin>>l>>r>>k;
if(k<mx){
c=1;
for(j=l+1;j<=r;j++){
if(w[j+1]<w[j]){
c=0;
break;
}
}
cout<<c<<endl;
continue;
}
c=0;
while(c==0){
c=1;
for(j=l;j<r;j++){
if(w[j]+w[j+1]<=k&&w[j]>w[j+1]){
c=0;
swap(w[j],w[j+1]);
}
}
}
c=1;
for(j=l;j<r;j++){
if(w[j]>w[j+1]){
c=0;
break;
}
}
cout<<c<<endl;
for(j=l;j<=r;j++){
w[j]=h[j];
}
}
}
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... | ||||
