/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 512.0 KiB
#3 Accepted 2ms 540.0 KiB
#4 Accepted 2ms 540.0 KiB
#5 Accepted 1ms 540.0 KiB
#6 Accepted 1ms 768.0 KiB
#7 Accepted 1ms 488.0 KiB
#8 Accepted 1ms 588.0 KiB
#9 Wrong Answer 1ms 540.0 KiB
#10 Accepted 1ms 516.0 KiB
#11 Accepted 1ms 332.0 KiB
#12 Accepted 1ms 556.0 KiB
#13 Accepted 1ms 540.0 KiB
#14 Accepted 2ms 528.0 KiB
#15 Wrong Answer 1ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define all(v) v.begin(),v.end()
#define nl "\n"
#define FIO \
    ios_base::sync_with_stdio(false);\
    cin.tie(NULL);\
    cout.tie(NULL);

void solve(){
    ll n; cin >> n;
    vector<pair<ll,ll>>v(n);
    for(ll i=0;i<n;i++){
        cin>>v[i].first>>v[i].second;
    }
    ll x,y; cin>>x>>y;
    bool up=false;
    for(ll i=0;i<n;i++){
        if(v[i].second>y)  up=true;
    }
    bool down=false;
    for(ll i=0;i<n;i++){
        if(y>v[i].second) down=true;
    }
    bool left=false;
    for(ll i=0;i<n;i++){
        if(x>v[i].first) left=true;
    }
    bool right=false;
    for(ll i=0;i<n;i++){
        if(x<v[i].first) right=true;
    }
    bool ok=true;
    for(int i=1; i<n; i++){
        if((v[i-1].first-v[i].first)*(y-v[i-1].second)==(v[i-1].second-v[i].second)*(x-v[i-1].first)){
            ok=false;
        }
    }
    if(up && down && left && right && ok) cout<<"YES\n";
    else cout<<"NO\n";
}

int32_t main()
{
 FIO
    ll t=1;
    // cin>>t;
    for(ll i=1;i<=t;i++)
    {
        // cout<<"Case "<<i<<": ";
        solve();
    }
}

Information

Submit By
Type
Submission
Problem
P1145 Nobita's Love for Shizuka
Contest
LU IUJPC : Sylhet Division 2024 Replay Contest
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-10 09:54:39
Judged At
2024-12-10 09:54:39
Judged By
Score
48
Total Time
2ms
Peak Memory
768.0 KiB