#include using namespace std; const long long MAXN=200; const long long MAXG=1000; int n, m, g; int a[MAXN+10][2004]; vector>v[MAXG+10]; int city[MAXG+10]; int dist[MAXN+10][203]; vector>graph[MAXN+10]; int brojka=0; struct ANS { vectorchildren; vectorpath; int sum; }; ANS answer[2005]; void fastIO() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } void input() { cin>>n>>m>>g; for (int i=1; i<=g; i++) cin>>city[i]; for (int i=1; i<=n; i++) { for (int j=1; j<=n; j++) { if (i==j) continue; dist[i][j]=1e9; } } for (int i=1; i<=n; i++) { for (int j=1; j<=2000; j++) { cin>>a[i][j]; } } for (int i=1; i<=g; i++) { for (int j=1; j<=2000; j++) { v[i].push_back({a[city[i]][j], j}); } sort(v[i].begin(), v[i].end()); } for (int i=1; i<=m; i++) { int x, y, c; cin>>x>>y>>c; dist[x][y]=min(c, dist[x][y]); dist[y][x]=min(c, dist[y][x]); graph[x].push_back({y, c}); graph[y].push_back({x, c}); } return; } void floyd() { for (int z=1; z<=n; z++) { for (int i=1; i<=n; i++) { for (int j=1; j<=n; j++) { if (i==z || i==j || z==j) continue; if (dist[i][z]==1e9 || dist[z][j]==1e9) continue; dist[i][j]=min(dist[i][z]+dist[z][j], dist[i][j]); } } } } void solve() { for (int i=1; i<=g; i++) { for (int j=1; j<=2000; j++) { int mom=v[i][j].second; if (answer[mom].children.size()<4) { answer[mom].children.push_back(i); answer[mom].sum+=v[i][j].first; break; } } } //while(true){}; for (int mom=1; mom<=2000; mom++) { if (answer[mom].children.size()) { //cout<q=answer[mom].children; sort(q.begin(), q.end()); vectorans; int mn=1e9; do { int prev=1; int tax=answer[mom].sum; int cena=0; for (int i=0; icena) { mn=cena; ans=q; } } while (next_permutation(q.begin(), q.end())); //cout<4*n) { while (true){}; } for (int j=0; juniq; uniq.push_back(answer[mom].path[0]); for (int j=1; j4*n) { while (true){}; } cout<