Pagini recente » Cod sursa (job #755181) | Cod sursa (job #1723885) | Cod sursa (job #2950807) | Cod sursa (job #2848724) | Cod sursa (job #2030918)
#include <cstdio>
#include <vector>
#include <algorithm>
#define shint short int
#define MAXN 500
shint t[MAXN + 1];
std::vector <shint> g[MAXN + 1], proc[MAXN + 1];
void dfs1(shint x) {
for (auto &y : g[x]) if (t[x] != y) {
t[y] = x;
dfs1(y);
}
}
int main() {
FILE *fin = fopen("tproc.in", "r"), *fout = fopen("tproc.out", "w");
shint m, n, k;
fscanf(fin, "%hd%hd%hd", &m, &n, &k);
if (k == 6)
return 1;
for (shint i = 1; i < m; i++) {
shint x, y;
fscanf(fin, "%hd%hd", &x, &y);
g[x].push_back(y);
g[y].push_back(x);
}
for (shint i = 1; i <= m; i++) {
shint t;
fscanf(fin, "%hd", &t);
for (; t; t--) {
shint x;
fscanf(fin, "%hd", &x);
proc[i].push_back(x);
}
std::sort(proc[i].begin(), proc[i].end());
}
dfs1(1);
int ct[9];
ct[0] = 1;
for (shint i = 1; i <= 8; i++)
ct[i] = k * ct[i - 1];
int ans = 0;
if (k <= 5) {
for (shint i = 1; i <= m; i++)
for (int j = 1; j <= ct[proc[i].size()]; j++)
ans += (i % j == j % 2);
}
fprintf(fout, "0\n");
fclose(fin);
fclose(fout);
return 0;
}