제출 #1284959

#제출 시각아이디문제언어결과실행 시간메모리
1284959alizhanHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
8 / 100
3095 ms10712 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1e9 + 7; const int N = (int)5e5 + 7; #define skip continue #define uno first #define duo second #define GO while(tt--) #define ins insert #define pb push_back #define all(x) x.begin(), x.end() #define Kaldun ios::sync_with_stdio(false); cin.tie(nullptr) #define int long long int bp(int a, int n) { if(n == 0) return 1; if(n % 2 == 1) return (bp(a, n-1) * a) % mod; long long b = bp(a, n/2); return (b * b) % mod; }int f[1001]; int comb(int n, int k){if(k < 0 || k > n) return 0;int d = (f[k] * 1LL * f[n - k]) % mod;return (f[n] * 1LL * bp(d, mod - 2)) % mod;} int lcm(int a,int b){ return (a * b) / __gcd(a,b);} void solve(){ int n,q; cin>>n>>q; int a[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]; } while(q--){ int l,r,k; cin>>l>>r>>k; int ok = 1; for(int i=l;i<=r;i++){ for(int j=i+1;j<=r;j++){ if( a[i] > a[j] && a[i] + a[j] > k){ ok=0; break; } } if(ok==0) break; } cout<<ok<<endl; } } signed main() { Kaldun; cout.precision(0); //freopen("time.in", "r", stdin); //freopen("time.out", "w", stdout); int tt=1; //cin>>tt; while(tt--){ 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...