#include #define rep(i,n) for(int i=0; i=0; i--) #define pers(i,n,s) for(int i=n-1; i>=s; i--) #define all(v) v.begin(),v.end() #define fi first #define se second #define pb push_back #define si(v) int(v.size()) #define lb(v,n) lower_bound(all(v),n) #define lbi(v,n) int(lower_bound(all(v),n) - v.begin()) #define ub(v,n) upper_bound(all(v),n) #define ubi(v,n) int(upper_bound(all(v),n) - v.begin()) #define mod 1000000007 #define infi 1010000000 #define infl 1100000000000000000 #define outve(v) {for(auto i : v) cerr << i << " ";cerr << endl;} #define outmat(v) for(auto i : v){for(auto j : i) cerr << j << " ";cerr << endl;} #define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];} #define IN(n,m,v) rep(i,n) rep(j,m){cin >> v[i][j];} #define cyes cout << "Yes" << endl #define cno cout << "No" << endl #define cYES cout << "YES" << endl #define cNO cout << "NO" << endl #define csp << " " << #define outset(n) cout << fixed << setprecision(n); using namespace std; using ll = long long; using ull = unsigned long long; using uint = unsigned int; using ld = long double; using vi = vector; using vvi = vector>; using vd = vector; using vvd = vector>; using vl = vector; using vvl = vector>; using vs = vector; using pii = pair; using pll = pair; template using ve = vector; template using vv = vector>; template using pq2 = priority_queue; template using pq1 = priority_queue,greater>; template bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;} template bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;} int popcnt(uint n) {return __builtin_popcount(n);} int popcntl(ull n) {return __builtin_popcountll(n);} int bsr(uint n) {return 31 - __builtin_clz(n);} int bsrl(ull n) {return 63 - __builtin_clzll(n);} int bsf(uint n) {return __builtin_ctz(n);} int bsfl(ull n) {return __builtin_ctzll(n);} const int LOCAL = 0; double TIME_LIMIT = 0.9; unsigned int xorshift() { static unsigned int tx = 123456789, ty=362436069, tz=521288629, tw=88675123; unsigned int tt = (tx^(tx<<11)); tx = ty; ty = tz; tz = tw; return ( tw=(tw^(tw>>19))^(tt^(tt>>8)) ); } class Solver { int N,M; vl planet_x,planet_y,station_x,station_y; ll alpha; int max_xy = 1001; int ti; double time; ll score; public: Solver(){ ti = clock(); alpha = 5; cin >> N >> M; planet_x.resize(N); planet_y.resize(N); rep(i,N) cin >> planet_x[i] >> planet_y[i]; station_x.assign(M,0); station_y.assign(M,0); score = -infl; } inline ll cal_dist(ll x0, ll y0, ll x1, ll y1){ return (x1-x0)*(x1-x0) + (y1-y0)*(y1-y0); } void solve(){ time = 1.0 * (clock() - ti) / CLOCKS_PER_SEC; int loop = 0; rep(i,M) station_x[i] = xorshift()%max_xy, station_y[i] = xorshift()%max_xy; double T1 = 1000, T0 = 0; double T = T1; while(time < TIME_LIMIT){ loop++; ll score0 = score; int change_n = xorshift()%M; int station_x0 = station_x[change_n]; int station_y0 = station_y[change_n]; int dd = 1000 + (100-1000)/TIME_LIMIT*time; int dx = xorshift()%dd*(xorshift()%2==0 ? -1:1), dy = xorshift()%dd*(xorshift()%2==0 ? -1:1); station_x[change_n] += dx,station_y[change_n] += dy; chmin(station_x[change_n],1000ll), chmin(station_y[change_n],1000ll); chmax(station_x[change_n],0ll), chmax(station_y[change_n],0ll); vi neigbor(N,-1); ll score1 = 0; rep(i,N){ ll d = infl; rep(j,M) if(chmin(d, cal_dist(station_x[j],station_y[j],planet_x[i],planet_y[i]))) neigbor[i] = j; score1 += d*2LL*alpha; } vvl D(M,vl(M,0)); rep(i,M) reps(j,i+1,M) D[i][j] = D[j][i] = cal_dist(station_x[i],station_y[i],station_x[j],station_y[j]); vvl dp(int(1<= 0){ int s0 = s; s = from[bit][s]; station_ord.pb(s); bit ^= int(1<