/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 1ms 532.0 KiB
#4 Accepted 1ms 444.0 KiB
#5 Accepted 1ms 332.0 KiB
#6 Accepted 1ms 532.0 KiB
#7 Accepted 1ms 532.0 KiB
#8 Accepted 1ms 532.0 KiB
#9 Accepted 1ms 532.0 KiB
#10 Accepted 4ms 532.0 KiB
#11 Accepted 4ms 536.0 KiB
#12 Accepted 5ms 328.0 KiB
#13 Accepted 5ms 536.0 KiB
#14 Accepted 4ms 532.0 KiB
#15 Accepted 5ms 532.0 KiB
#16 Accepted 5ms 532.0 KiB
#17 Accepted 5ms 532.0 KiB
#18 Accepted 5ms 532.0 KiB
#19 Accepted 4ms 532.0 KiB
#20 Accepted 5ms 496.0 KiB
#21 Accepted 5ms 580.0 KiB
#22 Accepted 6ms 532.0 KiB
#23 Accepted 5ms 532.0 KiB
#24 Accepted 5ms 532.0 KiB
#25 Accepted 5ms 532.0 KiB
#26 Accepted 6ms 532.0 KiB
#27 Accepted 4ms 532.0 KiB
#28 Wrong Answer 4ms 532.0 KiB
#29 Accepted 4ms 532.0 KiB

Code

//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<numeric>
//stl
#include<vector>
#include<list>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<stack>
#include<queue>
#include<deque>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll>vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef list<int> li;
typedef set<int> sti;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef unordered_map<int, int> umii;
typedef unordered_map<ll, ll> umll;
typedef unordered_set<ll> us;
typedef priority_queue<ll> pq;
typedef deque<ll> dq;
#define nl "\n"
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define Yes cout<<"YES\n";
#define No cout<<"NO\n";
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
#define F first
#define sc second
#define all(v) v.begin(), v.end()
#define sortv(v) sort(v.begin(), v.end());
#define rsort(v) sort(v.rbegin(), v.rend());
#define revv(v) reverse(v.begin(), v.end());

const int N=1e6+9;
const int mod1=1e9+7, mod2=1e9+9;
const int base1=29, base2=67;
const long long int inf=1e18;
const long double eps=1e-9;
#define saiful_islam_bk

struct point{
 double x, y;
 point(){x=y=0.0;}
 point(double _x, double _y) : x(_x), y(_y) {}
 bool operator<(point p) const{
 if(fabs(x-p.x)>eps) return x<p.x;
 return y<p.y;
 }
 bool operator==(point p) const{
 return fabs(x-p.x)<eps && fabs(y-p.y)<eps;
  }
};

ll ori(point a, point b, point c){
 ll val=(c.x-b.x)*(b.y-a.y)-(b.x-a.x)*(c.y-b.y);
 return (val?val/abs(val):0);
}
bool onseg(point a, point b, point c){
 return c.x<=max(a.x, b.x) && c.x>=min(a.x, b.x) && 
c.y<=max(a.y, b.y) && c.y>=min(a.y, b.y);
}
bool is_intersect(point a, point b, point c, point d){
 return ori(a, b, c)!=ori(a, b, d) && ori(c, d, a)!=ori(c, 
d, b);
 return ori(a, b, c)==0 && onseg(a, b, c);
 return ori(a, b, d)==0 && onseg(a, b, d);
 return ori(c, d, a)==0 && onseg(c, d, a);
 return ori(c, d, b)==0 && onseg(c, d, b);
 return 0;
}

void solve(){
	ll n, m=0, k=0; cin>>n;
	vector<point>p(n);
	for(ll i=0; i<n; i++){
		cin>>p[i].x>>p[i].y;
	}
	point X; cin>>X.x>>X.y;
	point Y; Y.x=1e9+5; Y.y=X.y+1;
	ll ans=0;
	for(ll i=0; i<n; i++){
	    if(is_intersect(p[i], p[(i+1)%n], X, Y)){
	        ans++;
	    }
	}
	if(ans&1) Yes
	else No
}
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
	saiful_islam_bk
	ll test=1;
	 //cin>>test;
	for(ll ii=1; ii<=test; ii++){
	    //cout<<"Case "<<ii<<": ";
	    solve();
	}
}

Information

Submit By
Type
Submission
Problem
P1145 Nobita's Love for Shizuka
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-18 17:39:50
Judged At
2025-01-18 17:39:50
Judged By
Score
98
Total Time
6ms
Peak Memory
580.0 KiB