#include // cout, endl, cin #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower #include //fixed,setprecision #include //INT_MAX #include //M_PI #include #include // 正規表現 #include //#include using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) std::random_device rnd; std::mt19937 mt(rnd()); const int n=100; const int m=8; int x[300],y[300]; int eki_x[300]; int eki_y[300]; bool visited[300]; int P[300]; int Q[300]; int cnt=0; int T[300]; vector>ans; class terry_yukico{ public: int ransu(int a,int b); double kyori(int p,int q); double evaluateScore(); void input(); void init(); void simulate(); void output(); }; int terry_yukico::ransu(int a, int b) { return a + rand() % (b - a + 1); } double terry_yukico::kyori(int p,int q){ return 5*5*((x[p]-x[q])*(x[p]-x[q]) + (y[p]-y[q])*(y[p]-y[q])); } double terry_yukico::evaluateScore(){ double sum = 0; for(int i=1;i<=n;i++) sum += kyori(P[i], P[i + 1]); return sum; } void terry_yukico::input(){ int ni,mi; cin>>ni>>mi; for(int i=1;i<=n;i++)cin>>x[i]>>y[i]; } void terry_yukico::init(){ P[1] = 1; P[n+1 ] = 1; for (int i = 2; i <=n; i++) P[i] = i; eki_x[0]=250;eki_y[0]=250; eki_x[1]=250;eki_y[1]=500; eki_x[2]=250;eki_y[2]=750; eki_x[3]=500;eki_y[3]=250; eki_x[4]=500;eki_y[4]=750; eki_x[5]=750;eki_y[5]=250; eki_x[6]=750;eki_y[6]=500; eki_x[7]=750;eki_y[7]=750; cnt=0; rep(i,300)T[i]=1; } void terry_yukico::simulate(){ double best_score=evaluateScore(); rep(i,200000){ int l=ransu(2,n); int r=ransu(2,n); if(l>r)swap(l,r); reverse(P+l,P+r+1); double now_score=evaluateScore(); //cout<<"best:"<=now_score)best_score=now_score; else reverse(P+l,P+r+1); } //cerr<<__LINE__<<"-----"<iki+kaeri){ after=iki+kaeri; num=j; } } if(moto>after){ if(cnt>=300)break; //cerr<<"cnt"<=cnt+i+2;j--)P[j]=P[j-1]; P[cnt+i+1]=num; T[cnt+i+1]=2; cnt++; ans.emplace_back(2,num+1); } //ans.push_back(1,Q[i+1]); } //ans.emplace_back(1,Q[n+1]); ans.emplace_back(1,1); //cerr<<__LINE__<<"-----"<