#pragma GCC target("avx2") #pragma GCC optimize("Ofast,unroll-loops") #include #include #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define ALL(a) a.begin(), a.end() typedef long double ldouble; #undef long #define long long long #define vec vector using namespace std; using mint = atcoder::modint; ostream &operator<<(ostream &os, mint a) { return os << a.val(); } template ostream &operator<<(ostream &os, vector &a) { const int n = a.size(); rep(i, n) { os << a[i]; if (i + 1 != n) os << " "; } return os; } template ostream &operator<<(ostream &os, array &a) { rep(i, n) os << a[i] << " \n"[i + 1 == n]; return os; } template istream &operator>>(istream &is, vector &a) { for (T &i : a) is >> i; return is; } template bool chmin(T &x, T y) { if (x > y) { x = y; return true; } return false; } template bool chmax(T &x, T y) { if (x < y) { x = y; return true; } return false; } void solve() { const auto start = chrono::system_clock::now(); constexpr int n = 45; int muda; cin >> muda; assert(muda == n); array a, b; rep(i, n) cin >> a[i] >> b[i]; array aa, bb; constexpr int m = 50; array ansu, ansv; constexpr long inf = 5e17; long ans = 7e18; array u, v; while (true) { const auto now_time = chrono::system_clock::now(); const auto elapsed_time = chrono::duration_cast(now_time - start).count(); if (elapsed_time > 900) break; rep(i, m - 1) { u[i] = rand() % n; v[i] = rand() % (n - 1); if (v[i] >= u[i]) v[i]++; } rep(i, n) { aa[i] = a[i]; bb[i] = b[i]; } rep(i, m - 1) { aa[u[i]] = aa[v[i]] = (aa[u[i]] + aa[v[i]]) / 2; bb[u[i]] = bb[v[i]] = (bb[u[i]] + bb[v[i]]) / 2; } u[m - 1] = 0; rep(i, n) { v[m - 1] = i; const long a0 = aa[0], ai = aa[i]; aa[0] = aa[i] = (a0 + ai) / 2; const long b0 = bb[0], bi = bb[i]; bb[0] = bb[i] = (b0 + bi) / 2; if (chmin(ans, max(abs(aa[0] - inf), abs(bb[0] - inf)))) { rep(i, m) ansu[i] = u[i]; rep(i, m) ansv[i] = v[i]; } aa[0] = a0, aa[i] = ai; bb[0] = b0, bb[i] = bi; } } int x = m; rep(i, m) if (ansu[i] == ansv[i]) x--; cout << x << '\n'; rep(i, m) if (ansu[i] != ansv[i]) cout << ansu[i] + 1 << " " << ansv[i] + 1 << '\n'; } int main() { srand((unsigned)time(NULL)); cin.tie(nullptr); ios::sync_with_stdio(false); // cout << fixed << setprecision(400); int t = 1; // cin >> t; while (t--) solve(); return 0; }