#define _CRT_SECURE_NO_WARNINGS //#define _GLIBCXX_DEBUG #include #define int ll using namespace std; typedef long long ll; typedef vector vi; typedef vector vvi; typedef pair pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; i ostream & operator<<(ostream & os, vector const &); template typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple const &){} template typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple const & t){ os << (n==0?"":" ") << get(t); _ot(os, t); } template ostream & operator<<(ostream & os, tuple const & t){ _ot<0>(os, t); return os; } template ostream & operator<<(ostream & os, pair const & p){ return os << "(" << p.first << ", " << p.second << ") "; } template ostream & operator<<(ostream & os, vector const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; } #ifdef DEBUG #define dump(...) (cerr<<#__VA_ARGS__<<" = "<> N){ a.resize(N); b.resize(N); rep(i,N) cin >> a[i] >> b[i]; pair ans = mp(solve(1),1); dump(ans); rep(i,N)rep(j,i){ int a1,a2,b1,b2; tie(a1,b1) = tie(a[i],b[i]); tie(a2,b2) = tie(a[j],b[j]); if(sign(a1-a2) == sign(b1-b2) || sign(b1-b2) == 0) continue; double x = - (a1-a2) / (b1-b2); for(int d=-1;d<=1;d++){ int xx = ceil(x+d); if(xx <= 0) xx = 1; int t = solve(xx); ans = min(ans,mp(t,xx)); } dump(ans); } // if(ans == inf) ans = 1; cout << ans.second << endl; } }