0_0_18864338_5421.cpp:2:105: error: 'vector' does not name a type
const int maxn = 50000+10; const int INF = 0x3f3f3f3f; const int maxk = 13; const int maxm = (1<<10)+10;vector<int> g[maxn];
^
0_0_18864338_5421.cpp:3:67: error: 'll' does not name a type
int n, k, s[maxn], vis[maxn], num[maxn], dp[maxk][maxn], w[maxn]; ll ans; void init(){ mem(vis, 0); ans = 0; }
^
0_0_18864338_5421.cpp: In function 'void init()':
0_0_18864338_5421.cpp:3:101: error: 'mem' was not declared in this scope
int n, k, s[maxn], vis[maxn], num[maxn], dp[maxk][maxn], w[maxn]; ll ans; void init(){ mem(vis, 0); ans = 0; }
^
0_0_18864338_5421.cpp:3:104: error: 'ans' was not declared in this scope
int n, k, s[maxn], vis[maxn], num[maxn], dp[maxk][maxn], w[maxn]; ll ans; void init(){ mem(vis, 0); ans = 0; }
^
0_0_18864338_5421.cpp: At global scope:
0_0_18864338_5421.cpp:4:1: error: 'PII' does not name a type
PII Find(int u, int f, int sum){ s[u] = 1; int lar = 0; PII tmp = MP(INF, 0); for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(v == f || vis[v]) continue; PII x = Find(v, u, sum); s[u] += s[v]; lar = max(lar, s[v]); tmp = min(tmp, x); } lar = max(lar, sum-s[u]); return min(tmp, MP(lar, u)); }
^
0_0_18864338_5421.cpp: In function 'void dfs2(int, int, int)':
0_0_18864338_5421.cpp:5:80: error: 'g' was not declared in this scope
void dfs2(int u, int f, int x){ num[x] ++; s[u]=1; for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(v == f || vis[v]) continue; dfs2(v, u, x|(1<<w[v])); s[u]+=s[v]; } }
^
0_0_18864338_5421.cpp: At global scope:
0_0_18864338_5421.cpp:6:1: error: 'll' does not name a type
ll cal(int u, int x){ ll ans = 0; for(int i = 0; i < (1<<k); i ++) num[i] = 0; dfs2(u, 0, x);
^
0_0_18864338_5421.cpp: In function 'void dfs(int, int, int)':
0_0_18864338_5421.cpp:9:55: error: 'Find' was not declared in this scope
void dfs(int u, int f, int sum){ u = Find(u, f, sum).Y; ans += cal(u, 1<<w[u]); vis[u] = 1; for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(vis[v]) continue; ans -= cal(v, (1<<w[u])|(1<<w[v])); } for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(!vis[v] && s[v] > 1) dfs(v, u, s[v]); } }
^
0_0_18864338_5421.cpp:9:63: error: 'ans' was not declared in this scope
void dfs(int u, int f, int sum){ u = Find(u, f, sum).Y; ans += cal(u, 1<<w[u]); vis[u] = 1; for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(vis[v]) continue; ans -= cal(v, (1<<w[u])|(1<<w[v])); } for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(!vis[v] && s[v] > 1) dfs(v, u, s[v]); } }
^
0_0_18864338_5421.cpp:9:84: error: 'cal' was not declared in this scope
void dfs(int u, int f, int sum){ u = Find(u, f, sum).Y; ans += cal(u, 1<<w[u]); vis[u] = 1; for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(vis[v]) continue; ans -= cal(v, (1<<w[u])|(1<<w[v])); } for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(!vis[v] && s[v] > 1) dfs(v, u, s[v]); } }
^
0_0_18864338_5421.cpp:9:121: error: 'g' was not declared in this scope
void dfs(int u, int f, int sum){ u = Find(u, f, sum).Y; ans += cal(u, 1<<w[u]); vis[u] = 1; for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(vis[v]) continue; ans -= cal(v, (1<<w[u])|(1<<w[v])); } for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(!vis[v] && s[v] > 1) dfs(v, u, s[v]); } }
^
0_0_18864338_5421.cpp:9:263: error: 'g' was not declared in this scope
void dfs(int u, int f, int sum){ u = Find(u, f, sum).Y; ans += cal(u, 1<<w[u]); vis[u] = 1; for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(vis[v]) continue; ans -= cal(v, (1<<w[u])|(1<<w[v])); } for(int i = 0; i < g[u].size(); i ++){ int v = g[u][i]; if(!vis[v] && s[v] > 1) dfs(v, u, s[v]); } }
^
0_0_18864338_5421.cpp: In function 'int main()':
0_0_18864338_5421.cpp:10:119: error: 'g' was not declared in this scope
int main() { while(scanf("%d%d", &n, &k) != EOF){ for(int i = 1; i <= n; i ++) scanf("%d", &w[i]), w[i] --, g[i].clear(); for(int i = 1; i < n; i ++){ int u, v; scanf("%d%d", &u, &v); g[u].push_back(v), g[v].push_back(u); } if(k == 1) { printf("%lld\n", 1ll*n*n); continue; } init(); dfs(1, 0, n); printf("%lld\n", ans); } return 0; }
^
0_0_18864338_5421.cpp:10:224: error: 'g' was not declared in this scope
int main() { while(scanf("%d%d", &n, &k) != EOF){ for(int i = 1; i <= n; i ++) scanf("%d", &w[i]), w[i] --, g[i].clear(); for(int i = 1; i < n; i ++){ int u, v; scanf("%d%d", &u, &v); g[u].push_back(v), g[v].push_back(u); } if(k == 1) { printf("%lld\n", 1ll*n*n); continue; } init(); dfs(1, 0, n); printf("%lld\n", ans); } return 0; }
^
0_0_18864338_5421.cpp:10:390: error: 'ans' was not declared in this scope
int main() { while(scanf("%d%d", &n, &k) != EOF){ for(int i = 1; i <= n; i ++) scanf("%d", &w[i]), w[i] --, g[i].clear(); for(int i = 1; i < n; i ++){ int u, v; scanf("%d%d", &u, &v); g[u].push_back(v), g[v].push_back(u); } if(k == 1) { printf("%lld\n", 1ll*n*n); continue; } init(); dfs(1, 0, n); printf("%lld\n", ans); } return 0; }
^
|