Submission #343331

#TimeUsernameProblemLanguageResultExecution timeMemory
343331jenkinsserHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3086 ms4204 KiB
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define st first #define nd second #define pii pair<int,int> #define N 1000005 #define INF 1e9+5 #define sp " " #define endl "\n" #define fastio() ios_base::sync_with_stdio(0);cin.tie(0); #define all(x) (x).begin(),(x).end() #define ll long long using namespace std; int n,m,w[N],l,r,k; int main(){ cin >> n >> m; for(int i=0;i<n;i++){ cin >> w[i]; } for(int i=0;i<m;i++){ cin >> l >> r >> k; int mx=0; for(int j=l;j<=r;j++){ int h=j-1; while(h>=l&&w[l]<w[h]){ mx=max(mx,w[l]+w[h]); h--; } } if(mx<=k) cout << 1 << endl; else cout << 0 << endl; } }
#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...