This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Balgabaev Mansur
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define pb push_back
#define int long long
using namespace std;
const int N=1e6+7;
const int MOD=1e9+7;
const int INF=1e18;
int binpow (int a, int n) {
if (n == 0)
return 1;
if (n % 2 == 1)
return binpow (a, n-1) * a;
else {
int b = binpow (a, n/2);
return b * b;
}
}
int a[N];
void solve(){
int n,m;
cin >> n >> m;
for(int i = 1 ; i <= n ; i++){
cin >> a[i];
}
for(int tt = 1 ; tt <= m ; tt++){
int l,r,k;
cin >> l >> r >> k;
bool ok=true;
for(int i = l ; i < r ; i++){
for(int j = i+1 ; j <= r ; j++){
if(a[i]+a[j] > k and a[i] > a[j]){
ok=false;
break;
}
}
if(!ok){
break;
}
}
cout << ok << '\n';
}
}
signed main() {
// freopen("closing.in", "r", stdin);
// freopen("closing.out", "w", stdout);
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int test = 1,cntx=1;
//cin >> test;
while (test--) {
//cout << "Case " << cntx << ':' << '\n';
solve();
cntx++;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |