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 <iostream>
using namespace std;
int n, m, w[1000001], wmax, l, r, k;
void read()
{
cin >> n >> m;
for(int i = 1; i <= n; ++i)
cin >> w[i];
}
bool solve()
{
wmax = 0;
cin >> l >> r >> k;
for(int i = l; i <= r; ++i)
{
if(w[i] < wmax && wmax + w[i] > k) return 0;
wmax = max(wmax, w[i]);
}
return 1;
}
int main()
{
read();
while(m--)
cout << solve() << '\n';
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... |