# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
158254 |
2019-10-15T19:28:58 Z |
TadijaSebez |
None (JOI16_snowy) |
C++11 |
|
0 ms |
0 KB |
#include "Anyalib.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
namespace _Anya
{
const int M=505;
vector<pair<int,int>> E[M];
int nod[M],dep[M],n;
int mark[M],csz;
vector<int> marked;
int DFS(int u, int p)
{
int mx=0;
for(auto e:E[u]) if(e.first!=p)
{
nod[e.second]=e.first;
int now=DFS(e.first,u);
mx=max(mx,now);
}
mx++;
if(mx>=11)
{
mx=0;
mark[u]=++csz;
marked.pb(u);
}
return mx;
}
void InitAnya(int N, int A[], int B[])
{
n=N;
for(int i=0;i<n;i++) E[i].clear();
for(int i=0;i<n;i++) mark[i]=0;
csz=0;marked.clear();
for(int i=0;i<n-1;i++)
{
E[A[i]].pb({B[i],i});
E[B[i]].pb({A[i],i});
}
DFS(0,-1);
}
void Pull(int u, int p)
{
for(auto e:E[u]) if(e.first!=p)
{
dep[e.first]+=dep[u];
Pull(e.first,u);
}
}
void Anya(int C[])
{
for(int i=0;i<n;i++) dep[i]=0;
for(int i=0;i<n-1;i++) dep[nod[i]]=C[i];
for(int i=0;i<n;i++) Save(i,dep[i]);
Pull(0,-1);
for(int i:marked)
{
for(int j=0;j<9;j++) Save(500+(mark[i]-1)*9+j,(dep[i]>>j)&1);
}
}
}
void InitAnya(int N, int A[], int B[])
{
_Anya::InitAnya(N,A,B);
}
void Anya(int C[])
{
_Anya::Anya(C);
}
Compilation message
/tmp/ccrhgCeb.o: In function `main':
grader_boris.cpp:(.text.startup+0x1b1): undefined reference to `InitBoris(int, int*, int*)'
grader_boris.cpp:(.text.startup+0x2be): undefined reference to `Boris(int)'
collect2: error: ld returned 1 exit status