#include #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep3(i, n, m) for (int i = m; i < (int)(n); i++) #define repr(i, n) for (int i = n-1; i >= 0; i--) #define all(v) v.begin(), v.end() #define SP << " " #define ll long long #define N_SIZE 100 #define M_SIZE 8 #define ALPHA 5 using namespace std; //定数周り int imax=2147483647; ll lmax=9223372036854775807; //焼きなましの定数 double TIME_LIMIT=985; double start_temp=100.0; double end_temp=10.0; //乱数の準備 // int seed=1; auto seed=(unsigned)time(NULL); mt19937_64 mt(seed); struct Pos{ int x; int y; Pos(){} Pos(int ix, int iy){ x=ix; y=iy; } bool operator<(const Pos &in) const{ return x!=in.x ? x wp; vector tour; vector sta_route; vector>> cluster; int score(){ set st; ll s=0; rep(i, tour.size()-1){ s+=wp[tour[i]].dist(wp[tour[i+1]]); if(tour[i]> pai; Pos cent={500, 500}; rep3(i, N_SIZE+M_SIZE, N_SIZE) pai.push_back({wp[i].pos.angle(cent), i-N_SIZE}); sort(all(pai)); int idx; rep(i, M_SIZE){ if(pai[i].second==0){ idx=i; break; } } sta_route.clear(); rep(i, M_SIZE){ sta_route.push_back(pai[(i+idx)%M_SIZE].second); // cout<< sta_route[i] <> n >> m; rep(i, N_SIZE){ cin>> planets[i].x >> planets[i].y; // a[i]=mt()%1001; // b[i]=mt()%1001; // cout<< a[i] SP << b[i] <(current - start).count() > TIME_LIMIT) break; // } // if(lp==400000) break; Travel travel=best; travel.move_station(); // 温度関数 double temp = start_temp + (end_temp - start_temp) * chrono::duration_cast(current - start).count() / TIME_LIMIT; // double temp=100; // 遷移確率関数(最大化の場合) double prob = exp((travel.score()-best.score())/temp); // cout<< travel.score() < (mt()%imax)/(double)imax) { // 確率probで遷移する // if(lp%1000==0){ // cout<< "lp:" << lp <