이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ull unsigned ll
#define ld long double
#define pb push_back
#define ppb pop_back
#define clr clear
#define len size()
#define beg begin()
#define end end()
#define ins insert
#define f first
#define s second
#define y1 y123456789
#define forn(i, l, r) for(int i = l; i <= r; ++i)
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
using namespace std;
using namespace __gnu_pbds;
typedef tree < int, null_type, greater_equal < int >,
rb_tree_tag, tree_order_statistics_node_update > ordered_set;
int n, m;
const int MAXN = (int)1e6 + 20;
int a[MAXN];
int main()
{
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
fastio;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
cin >> a[i];
while (m--)
{
int l, r, k;
cin >> l >> r >> k;
int mx = a[l], ans = 0;
for (int i = l + 1; i <= r; ++i)
{
if (mx > a[i])
ans = max(ans, a[i] + mx);
mx = max(mx, a[i]);
}
cout << (ans <= k) << '\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... |