Submission #450359

#TimeUsernameProblemLanguageResultExecution timeMemory
450359mariowongHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3065 ms5776 KiB
#include <bits/stdc++.h> using namespace std; long long t,n,m,q,ans,sum,ct,l,r,a[200005],b[200005],ans1,ans2; string s; bool g[2005]; int main() { ios::sync_with_stdio(false); cin >> n >> m; for (int i=1;i<=n;i++){ cin >> a[i]; } for (int i=1;i<=m;i++){ cin >> l >> r >> ct; sum=0; ans=0; for (int j=l;j<=r;j++){ ans=max(ans,a[j]); if (ans != a[j]) sum=max(sum,ans+a[j]); } if (sum <= ct) cout << "1\n"; else cout << "0\n"; } return 0; } // // // // // // //
#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...