제출 #1122172

#제출 시각아이디문제언어결과실행 시간메모리
1122172LuvidiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
17 / 100
3053 ms33548 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define fs first #define sc second #define pb push_back void solve() { int n,q; cin>>n>>q; int a[n]; for(int i=0;i<n;i++)cin>>a[i]; while(q--){ int l,r,k; cin>>l>>r>>k; l--;r--; int mx=0; set<int> s; for(int i=l;i<=r;i++){ s.insert(a[i]); if(*s.rbegin()>a[i])mx=max(mx,a[i]+*s.rbegin()); } if(mx<=k)cout<<"1\n"; else cout<<"0\n"; } } int main() { #ifdef FPO freopen("in","r",stdin); freopen("out","w",stdout); #endif ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); }
#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...