Submission #499019

#TimeUsernameProblemLanguageResultExecution timeMemory
499019IOI_champion_in_1980Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3096 ms4300 KiB
#include <bits/stdc++.h> #include <math.h> typedef long long ll; using namespace std; ll i, j, t, a, n, m, b, c, d, f, g; int x[1000100], y[1000100]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin>>n>>m; for (a=1; a<=n; a++) cin>>x[a]; for (a=1; a<=m; a++) { int l, r, k; cin>>l>>r>>k; int ans=1; int mx = -1e9; for(int i = l;i <= r;i++){ if(mx > x[i] and mx + x[i] > k) ans = 0; mx = max(mx,x[i]); } cout<<ans<<'\n'; // for (b=l; b<=r; b++) y[b-l+1]=x[b]; // for (b=(r-l)+1; b>=2; b=b-2) // { // int mmax1=y[b-1], mmax2=y[b]; // int p1=b-1, p2=b; //// int r=0; // for (c=b; c>=1; c--) // { // if (y[c]>mmax1) // { //// r=1; // mmax2=mmax1; // mmax1=y[c]; // p2=p1; // p1=c; // } // } //// for (c=1; c<=n; c++) cout<<y[c]<<" "; //// cout<<endl; // if (p1==b-1 and p2==b and y[b]>=y[b-1]) // { // b++; // continue; // } // if (y[p1]+y[p2]>k) // { // ans=0; // break; // } // swap(y[b], y[p1]); // swap(y[b-1], y[p2]); //// for (c=1; c<=n; c++) cout<<y[c]<<" "; //// cout<<endl; // } // cout<<ans<<endl; } } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...