# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
701730 | scottchou | Deblo (COCI18_deblo) | C++17 | 339 ms | 18776 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;
int const N = 1e5 + 5;
typedef long long LL;
int a[N];
vector<int> graph[N];
LL cnt0[N], cnt1[N];
void dfs(int x, int tw, int fa = -1){
cnt0[x] = 0;
cnt1[x] = 0;
for(auto i : graph[x]){
if(i == fa)
continue;
dfs(i, tw, x);
cnt0[x] += cnt0[i];
cnt1[x] += cnt1[i];
}
if(a[x] & (1 << tw)){
swap(cnt0[x], cnt1[x]);
cnt1[x]++;
}else{
cnt0[x]++;
}
}
LL ans = 0;
void dfs2(int x, int tw, LL up0 = 0, LL up1 = 0, int fa = -1){
ans += cnt1[x] * (1 << tw);
if(a[x] & (1 << tw))
swap(up0, up1);
ans += up1 * (1 << tw);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |