Submission #931793

#TimeUsernameProblemLanguageResultExecution timeMemory
931793AiperiiiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
8 / 100
3045 ms17204 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n,q; cin>>n>>q; vector <int> a(n+1); for(int i=1;i<=n;i++)cin>>a[i]; while(q--){ int l,r,x; cin>>l>>r>>x; vector <int> v; for(int i=l;i<=r;i++)v.pb(a[i]); bool ok=1; for(int i=v.size()-1;i>=0;i--){ for(int j=v.size()-1;j>i;j--){ if(v[i]>v[j]){ if(x<v[i]+v[j])ok=0; } } } cout<<ok<<"\n"; } } /* 5 2 3 5 1 8 2 1 3 6 2 5 3 7 1 2 8 9 8 10 3 1 1 7 12 2 8 9 8 10 1 3 2 8 9 8 1 3 10 2 8 9 1 3 8 10 2 8 1 3 8 9 10 2 1 3 8 8 9 10 1 2 3 8 8 9 10 */
#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...