# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
336415 | Joshc | Tenis (COI19_tenis) | C++11 | 266 ms | 6892 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 <cstdio>
#include <algorithm>
using namespace std;
int n, pos[3][100001], seg[400001], seg2[400001];
void update(int v, int tl, int tr, int pos, int x) {
if (tl == tr) {
seg[v] += x;
seg2[v] += x;
} else {
int tm = (tl+tr) >> 1;
if (pos <= tm) update(v<<1, tl, tm, pos, x);
else update(v<<1|1, tm+1, tr, pos, x);
seg[v] = min(seg[v<<1], seg2[v<<1]+seg[v<<1|1]);
seg2[v] = seg2[v<<1]+seg2[v<<1|1];
}
}
int query(int v, int tl, int tr, int s) {
if (tl == tr) return tl;
int tm = (tl+tr) >> 1;
if (seg[v<<1] <= s) return query(v<<1, tl, tm, s);
return query(v<<1|1, tm+1, tr, s-seg2[v<<1]);
}
void change(int v, int x) {
update(1, 1, n, min(min(pos[0][v], pos[1][v]), pos[2][v]), x);
update(1, 1, n, max(max(pos[0][v], pos[1][v]), pos[2][v]), -x);
}
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... |