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>
using namespace std;
int n, m;
int w[1000005];
int main()
{
// freopen("Input.txt", "r", stdin);
cin >> n >> m;
for(int i = 1; i <= n; i++)
{
cin >> w[i];
}
for(int i = 1; i <= m; i++)
{
int l, r, x;
cin >> l >> r >> x;
bool ok = true;
for(int j = l; j <= r; j++)
{
for(int k = j + 1; k <= r; k++)
{
if(w[j] > w[k] and (w[j] + w[k] > x))
{
ok = false;
}
}
}
if(ok)
{
cout << 1 << '\n';
}
else
{
cout << 0 << '\n';
}
}
}
# | 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... |