//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using lg = long long; #define TEST clog << "TEST" << endl #define IINF 2147483647 #define LLINF 9223372036854775807LL #define AMARI 998244353 #define TEMOTO ((sizeof(long double) == 16) ? false : true) #define TIME_LIMIT 950 * (TEMOTO ? 1 : 1000) #define el '\n' #define El '\n' //疑似乱数(XorShift) unsigned long xor128(void) { static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123; unsigned long t = (x xor (x << 11)); x = y; y = z; z = w; return (w = (w xor (w >> 19)) xor (t xor (t >> 8))); } int wakusei_num, station_num; class planet { public: int x; int y; int num; }; bool hikaku_rad(planet a, planet b) { return (atan2(a.y - 500, a.x - 500) < atan2(b.y - 500, b.x - 500)); } int planet_distance(planet const& a, planet const& b) { int ans = (a.x - b.x) * (a.x - b.x); ans += (a.y - b.y) * (a.y - b.y); return ans; } class station { public: int x; int y; int num; }; vector wakusei(100); //a番目とa+1番目をswapすることを考える int kinbou_hyouka(int a) { //(a-1,a)と(a+1,a+2)を引く if (a <= 0 || a + 2 >= 100)return IINF; int ans = -1 * planet_distance(wakusei[a - 1], wakusei[a]); ans -= planet_distance(wakusei[a + 1], wakusei[a + 2]); //(a-1,a+1)と(a,a+2)を足す ans += planet_distance(wakusei[a - 1], wakusei[a + 1]); ans += planet_distance(wakusei[a], wakusei[a + 2]); return ans; } #define MULTI_TEST_CASE false void solve(void) { cin >> wakusei_num >> station_num; for (int i = 0; i < wakusei_num; i++) { cin >> wakusei[i].x >> wakusei[i].y; wakusei[i].num = i; } clock_t start = clock(); for (int i = 0; i < station_num; i++) { cout << "0 0" << El; } cout << wakusei_num + 1 << el; sort(wakusei.begin(), wakusei.end(), hikaku_rad); while (clock() - start <= TIME_LIMIT) { int rand_num = xor128() % 100; if (kinbou_hyouka(rand_num) < 0) { swap(wakusei[rand_num], wakusei[rand_num + 1]); } } for (int i = 0; i < wakusei_num; i++) { if (!wakusei[i].num) { for (int j = i; j <= i + wakusei_num; j++) { cout << "1 " << wakusei[j % wakusei_num].num + 1 << el; } break; } } return; } void calc(void) { return; } int main(void) { cin.tie(nullptr); ios::sync_with_stdio(false); int t = 1; if (MULTI_TEST_CASE)cin >> t; while (t--) { solve(); } calc(); return 0; }