# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102700 | bert30702 | Werewolf (IOI18_werewolf) | C++17 | 2834 ms | 165872 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>
#include "werewolf.h"
using namespace std;
const int MX = 2e5 + 100;
vector<int> G[MX], G_mx[MX], G_mn[MX];
int boss_mx[MX], boss_mn[MX];
int l_mx[MX], r_mx[MX], l_mn[MX], r_mn[MX], tmp[MX];
vector<int> ptr_mn[MX], ptr_mx[MX];
vector<int> T[MX * 4];
void build_ptr_mn(int u, int p, int &ptr) {
l_mn[u] = ++ptr;
tmp[ptr] = u;
if(p != -1) {
ptr_mn[u].push_back(p);
while(ptr_mn[ptr_mn[u].back()].size() >= ptr_mn[u].size()) {
ptr_mn[u].push_back(ptr_mn[ptr_mn[u].back()][ptr_mn[u].size() - 1]);
}
}
for(auto it: G_mn[u]) build_ptr_mn(it, u, ptr);
r_mn[u] = ptr;
}
void build_ptr_mx(int u, int p, int &ptr) {
l_mx[u] = ++ptr;
if(p != -1) {
ptr_mx[u].push_back(p);
while(ptr_mx[ptr_mx[u].back()].size() >= ptr_mx[u].size()) {
ptr_mx[u].push_back(ptr_mx[ptr_mx[u].back()][ptr_mx[u].size() - 1]);
}
}
for(auto it: G_mx[u]) build_ptr_mx(it, u, ptr);
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... |