#include"stdio.h" #include"vector" #include"cmath" #include"cassert" #include"algorithm" #define N 50 #define INF 1000000000 using namespace std; //long long abs(long long a) { return a>0 ? a: -a; } struct point { int x, y, w; void read() { scanf("%d%d%d", &x, &y, &w); } } pts[N]; long long area(int i, int j, int k) { return (pts[i].x - pts[k].x) * (long long) (pts[j].y - pts[i].y) - (pts[i].x - pts[j].x) * (long long) (pts[k].y - pts[i].y); } long long aarea(int i, int j, int k) { return abs(area(i, j, k)); } int n; int cost[N][N][N]; typedef int PATH; PATH dp[N+1][N][N]; PATH ans[N+1]; int a, b; int main () { scanf("%d", &n); for(int i=0; i v{i, j, k}; sort(v.begin(), v.end()); cost[i][j][k] = cost[v[0]][v[1]][v[2]]; } for(int i=0; i<=n; i++) ans[i] = INF; for(a=0; a= INF) continue; for(int next=0; next<=a; next++) { if(area(p, q, next)<=0 || (next != a && (area(a, q, next)<=0 || area(a, b, next)<=0))) continue; if(next == a && area(q, a, b)<=0) continue; int candidate = cost[a][q][next] + pts[next].w + dp[l][p][q]; dp[l+1][q][next] = min(dp[l+1][q][next], candidate); if(next==a) { ans[l+1] = min(ans[l+1], dp[l+1][q][a]); } } } } } for(int len=3; len<=n; len++) { int res = ans[len]; printf("%d ", res>=INF ? -1 : res); } }