# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
382147 | BartolM | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3093 ms | 27692 KiB |
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;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
typedef pair <pii, int> ppi;
typedef pair <ll, ll> pll;
const int INF=0x3f3f3f3f;
const int N=1e6+50;
const int OFF=(1<<20);
int n, q;
int p[N], sol[N];
int T[2*OFF], levi[N];
vector <ppi> que[N];
vector <int> st;
void load() {
scanf("%d %d", &n, &q);
for (int i=0; i<n; ++i) scanf("%d", &p[i]);
for (int i=0; i<q; ++i) {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
int res=0;
for (int j=a; j<=b; ++j) {
for (int k=j+1; k<=b; ++k) {
if (p[k]<p[j]) res=max(res, p[j]+p[k]);
}
}
printf("%d\n", res<=c);
}
}
int main() {
load();
return 0;
}
Compilation message (stderr)
# | 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... |