#include #include #include using lint = long long; constexpr lint INF = 1LL << 60; void solve() { int n; std::cin >> n; std::vector> ps(n); for (auto& [a, b] : ps) std::cin >> b >> a; std::vector xs{1}; for (int i = 0; i < n; ++i) { auto [a1, b1] = ps[i]; for (int j = 0; j < n; ++j) { auto [a2, b2] = ps[j]; if (b1 >= b2) continue; lint ok = 1, ng = 1 << 30; // a1 * ok + b1 < a2 * ok + b2 while (ng - ok > 1) { auto mid = (ok + ng) / 2; if (a1 * mid + b1 < a2 * mid + b2) { ok = mid; } else { ng = mid; } } xs.push_back(ok); xs.push_back(ng); } } std::sort(xs.begin(), xs.end()); xs.erase(std::unique(xs.begin(), xs.end()), xs.end()); lint min = INF, xmin = 0; for (auto x : xs) { lint l = INF, r = -INF; for (auto [a, b] : ps) { lint y = a * x + b; l = std::min(l, y); r = std::max(r, y); } if (r - l < min) { min = r - l; xmin = x; } } std::cout << xmin << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }