/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 1ms 376.0 KiB
#4 Wrong Answer 1ms 528.0 KiB
#5 Accepted 1ms 328.0 KiB
#6 Accepted 1ms 540.0 KiB
#7 Accepted 1ms 556.0 KiB
#8 Wrong Answer 1ms 540.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define yes cout << "YES" << "\n";
#define no cout << "NO" << "\n";
#define fri(a,b) for(ll i = a; i<b; i++) 
#define frj(a,b) for(ll j = a; j <b; j++)
#define frk(a,b) for(ll k = a; k <b; k++) 
#define rfri(a,b) for(ll i = a; i>=b; i--)

using namespace std;
int main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL);

    ll T = 1;
    // cin >> T;
    while(T--)
    {
     ll x,y,n;
     cin >> n;
     bool pos = 0;
     vector < pair <ll,ll> > v;
     ll minx = INT_MAX;
     ll maxx = INT_MIN;
     ll miny = INT_MAX;
     ll maxy = INT_MIN;
     ll j = 0;
     while(n--)
     {
        ll x1,y1;
        cin >> x1 >> y1;
        if(x1 > maxx) maxx = x1;
        if(x1 < minx) minx = x1;
        if(y1 < miny) miny = y1;
        if(y1 > maxy) maxy = y1;
        v.pb({x1,y1});
     }
     cin >> x >> y;
     ll first = 0;
     ll second = 0;
     v.push_back({v[0].first,v[0].second});
     fri(0,v.size()-1)
     {
       first += v[i].first*v[i+1].second;
     }
    //  cout << first << "\n";
      fri(0,v.size()-1)
    {
        second += v[i].second*v[i+1].first;
    }
    //  cout << second << "\n";
     ll bohuvuj = abs(first - second);
    //  cout << bohuvuj << "\n";
     ll total = 0;
     fri(0,v.size()-1)
     {
        frj(i+1,v.size() - 1)
        {
            vector < pair <ll,ll> > t;
            t.pb({v[i].first,v[i].second});
            t.pb({v[j].first, v[j].second});
            t.pb({x,y});
            t.pb({v[i].first,v[i].second});

            ll f = 0;
            ll s = 0;

            for(ll k = 0 ; k< t.size()-1; k++)
            {
                f += t[k].first*t[k+1].second;
                s += t[k].second*t[k+1].first;
            }
            total += abs(f-s);
        }
     }
    if(total != bohuvuj) no
    else 
    {
        if(total != 0) yes
        else
        {
          fri(0,v.size()-1)
          {
            if(v[i].first == x && v[i].second == y)
            {
                pos = 1;
                break;
            }
          }
          if(pos) yes
          else no
        }
    }
    }
}

Information

Submit By
Type
Submission
Problem
P1145 Nobita's Love for Shizuka
Contest
LU IUJPC : Sylhet Division 2024
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-09 09:11:35
Judged At
2024-12-09 09:11:35
Judged By
Score
20
Total Time
1ms
Peak Memory
556.0 KiB