0w1

CFR 593 B. Anton and Lines ( Ad hoc )

Problem - B - Codeforces
I thought this was a little difficult for pB.
Observe and we will find that we want to know whether there exist at least two pairs of ( a, b ) and ( a', b' ), where both a indicates y value on x1, b indicates y value on x2, such that a < a' and b > b'. So we will simply sort once and find if that happens.

void solve(){
    int N; cin >> N;
    int X1, X2; cin >> X1 >> X2;
    vector< pair< ll, ll > > l_r;
    for( int i = 0; i < N; ++i ){
        int K, B; cin >> K >> B;
        l_r.push_back( pii( 1LL * K * X1 + B, 1LL * K * X2 + B ) );
    }
    sort( l_r.begin(), l_r.end() );
    for( int i = 0; i + 1 < N; ++i )
        if( l_r[ i ].first < l_r[ i + 1 ].first and
                l_r[ i ].second > l_r[ i + 1 ].second ){
            cout << "YES\n";
            return;
        }
    cout << "NO\n";
}