# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
109022 | PeppaPig | Werewolf (IOI18_werewolf) | C++14 | 2494 ms | 220804 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 "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
int n, m, q;
struct node {
int d;
node *l, *r;
node(int d, node *l, node *r) : d(d), l(l), r(r) { }
};
node* newleaf(int d) { return new node(d, nullptr, nullptr); }
node* newpar(node *l, node *r) { return new node(l->d + r->d, l, r); }
node* build(int l = 1, int r = n) {
if(l == r) return newleaf(0);
int mid = (l + r) >> 1;
return newpar(build(l, mid), build(mid+1, r));
}
node* update(node *p, int x, int l = 1, int r = n) {
if(l == r) return newleaf(p->d + 1);
int mid = (l + r) >> 1;
if(x <= mid) return newpar(update(p->l, x, l, mid), p->r);
else return newpar(p->l, update(p->r, x, mid+1, r));
}
# | 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... |