This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
const int maxn = 1e6+5;
int n,m;
int w[maxn];
bool check(int l, int r, int k)
{
int maxch = 0;
int razmqna = 0;
for(int i = l; i <= r; i++)
{
if(maxch>w[i]) razmqna = max(razmqna,maxch+w[i]);
maxch = max(maxch,w[i]);
}
return k >= razmqna;
}
void read()
{
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> w[i];
int l,r,k;
for(int i = 1; i <= m; i++)
{
cin >> l >> r >> k;
if(check(l,r,k)) cout << 1 << endl;
else cout << 0 << endl;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
read();
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... |