#include #include #define rep(i,a,b) for(int i=a;i=a;i--) #define all(x) (x).begin(),(x).end() #define pb(x) push_back(x); templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b P; const int N = 45; const int M = 50; ll A[N],B[N]; void Input(){ int _n;cin >> _n; rep(i,0,N)cin >> A[i] >> B[i]; } struct Solution{ int X; vector u,v; P Simulate(){ ll a[N],b[N];rep(i,0,N)a[i]=A[i],b[i]=B[i]; rep(i,0,X){ ll tmp1=(a[u[i]]+a[v[i]])/2; ll tmp2=(b[u[i]]+b[v[i]])/2; a[u[i]]=tmp1;a[v[i]]=tmp1; b[u[i]]=tmp2;b[v[i]]=tmp2; } return P(a[0],b[0]); } void Output(){ cout << X << endl; rep(i,0,X)cout << u[i]+1 << " " << v[i]+1 << endl; } }; Solution InitSolve(){ Solution res_sol; rep(i,0,M){ while(true){ int x=random()%N; int y=random()%N; if(x==y)continue; res_sol.u.pb(x); res_sol.v.pb(y); res_sol.X++; break; } } return res_sol; } Solution HillClimbing(Solution sol){ Solution now_sol=sol; P now_score=now_sol.Simulate(); ll now_v1=abs(BASE-now_score.first); ll now_v2=abs(BASE-now_score.second); while((double)(clock()-start)/CLOCKS_PER_SECmax(next_v1,next_v2)){ now_v1=next_v1; now_v2=next_v2; now_score=next_score; } else{ now_sol.u[idx]=pre_x; now_sol.v[idx]=pre_y; } } return now_sol; } int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); Input(); Solution sol=InitSolve(); P res=sol.Simulate(); sol=HillClimbing(sol); cerr << res.first << " " << res.second << endl; sol.Output(); }