Submission #493168

#TimeUsernameProblemLanguageResultExecution timeMemory
493168erkmHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++11
8 / 100
3085 ms6964 KiB
#include<bits/stdc++.h> #define loop(n) for(int i=0; i<n; i++) #define ll long long #define ld long double #define ull unsigned long long #define ff first #define ss second #define p_b push_back #define l_b lower_bound #define u_b upper_bound #define m_p make_pair #define m_t make_tuple #define ar array using namespace std; const int M=1e9, mxN=1e5; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); //cout.tie(NULL); int n, m; cin>>n>>m; int w[n]; for(int i=0; i<n; i++){ cin>>w[i]; } while(m--){ int l, r, k; cin>>l>>r>>k; l--; r--; int ans=0; for(int i=l; i<=r; i++){ for(int j=i+1; j<=r; j++){ if(w[i]>w[j]){ ans=max(ans, w[i]+w[j]); } } } // cout<<ans<<endl; ans>k? cout<<0: cout<<1; cout<<'\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...