Submission #1058434

#TimeUsernameProblemLanguageResultExecution timeMemory
1058434trucmaiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
17 / 100
3067 ms8304 KiB
#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 6; int n,q; long long a[N]; signed main() { cin.tie(0)->sync_with_stdio(0); cin>>n>>q; for(int i = 1;i <= n;++i) cin>>a[i]; while(q--){ int l,r,k; cin>>l>>r>>k; long long temp = 0,temp2 = a[l]; for (int i = l + 1; i <= r; i++){ if (a[i] >= temp2) temp2 = a[i]; else temp = max(temp, temp2 + a[i]); } cout<<(temp <= k ? 1 : 0)<<"\n"; } }
#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...