# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
768875 | keta_tsimakuridze | Jousting tournament (IOI12_tournament) | C++14 | 146 ms | 15344 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 pii pair<int,int>
#define f first
#define s second
const int N = 2e5 + 5;
int n;
int lz[4 * N], t[4 * N], fw[N];
void upd(int u, int id, int l, int r) {
if(l > id || r < id) return;
if(l == r) {
t[u] ^= 1;
return;
}
int mid = (l + r) / 2;
upd(2 * u, id, l, mid); upd(2 * u + 1, id, mid + 1, r);
t[u] = t[2 * u] + t[2 * u + 1];
}
int get(int u, int l, int r, int id) {
if(l == r) return l;
int mid = (l + r) / 2;
if(t[2 * u] >= id) return get(2 * u, l, mid, id);
return get(2 * u + 1, mid + 1, r, id - t[2 * u]);
}
void upd(int id, int v) {
++id;
for(id; id <= n; id += id & (-id)) fw[id] += v;
}
int get(int id) {
int ans = 0; ++id;
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... |