# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
828694 | jlallas384 | Jousting tournament (IOI12_tournament) | C++17 | 1070 ms | 251900 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;
struct tree{
tree *lc = nullptr, *rc = nullptr;
int sum = 0, l, r;
tree(int i, int j){
l = i, r = j;
if(l == r){
sum = 1;
}else{
int m = (l + r) / 2;
lc = new tree(l, m);
rc = new tree(m + 1, r);
sum = lc->sum + rc->sum;
}
}
void upd(int i){
if(l == r){
sum = 0;
}else{
if(i <= lc->r) lc->upd(i);
else rc->upd(i);
sum = lc->sum + rc->sum;
}
}
int kth(int i){
if(l == r) return l;
int ls = lc->sum;
if(i > ls) return rc->kth(i - ls);
else return lc->kth(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... |