# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875895 | rainboy | Potatoes and fertilizers (LMIO19_bulves) | C11 | 289 ms | 30548 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 <stdio.h>
#define N 500000
long long min(long long a, long long b) { return a < b ? a : b; }
long long xx[(N + 1) * 2]; int iq[2][(N + 1) * 2 + 1], pq[2][(N + 1) * 2], cnt[2], mode;
int lt(int i, int j) {
return mode == 0 ? xx[i] > xx[j] : xx[i] < xx[j];
}
int p2(int p) {
return (p *= 2) > cnt[mode] ? 0 : (p < cnt[mode] && lt(iq[mode][p + 1], iq[mode][p]) ? p + 1 : p);
}
void pq_up(int i) {
int p, q, j;
for (p = pq[mode][i]; (q = p / 2) && lt(i, j = iq[mode][q]); p = q)
iq[mode][pq[mode][j] = p] = j;
iq[mode][pq[mode][i] = p] = i;
}
void pq_dn(int i) {
int p, q, j;
for (p = pq[mode][i]; (q = p2(p)) && lt(j = iq[mode][q], i); p = q)
iq[mode][pq[mode][j] = p] = j;
iq[mode][pq[mode][i] = p] = i;
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... |