Submission #401294

#TimeUsernameProblemLanguageResultExecution timeMemory
401294NintsiChkhaidzeHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3069 ms10080 KiB
#include <bits/stdc++.h> #define pb push_back #define mod 1000000007 #define ll long long using namespace std; const int N = 1000005; int a[N],b[N],l,r,k,n,q,i; main (){ ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL); cin>>n>>q; for (i=1;i<=n;i++) cin>>a[i]; while(q--){ cin>>l>>r>>k; bool q=1; b[l] = 0; for (i= l + 1;i<=r;i++){ b[i] = b[i - 1]; if (b[i] < a[i - 1]) b[i] = a[i - 1]; if (b[i] > a[i] && b[i] + a[i] > k) {q=0; break;} } cout<<q<<"\n"; } }

Compilation message (stderr)

sortbooks.cpp:8:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main (){
      |       ^
#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...