/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 2ms 384.0 KiB
#3 Accepted 2ms 396.0 KiB
#4 Accepted 2ms 348.0 KiB
#5 Accepted 2ms 540.0 KiB
#6 Accepted 2ms 328.0 KiB
#7 Accepted 2ms 344.0 KiB
#8 Accepted 2ms 496.0 KiB
#9 Accepted 2ms 492.0 KiB
#10 Accepted 2ms 324.0 KiB
#11 Accepted 2ms 540.0 KiB
#12 Accepted 2ms 496.0 KiB
#13 Accepted 2ms 496.0 KiB
#14 Accepted 2ms 328.0 KiB
#15 Accepted 2ms 332.0 KiB
#16 Accepted 2ms 332.0 KiB
#17 Accepted 2ms 328.0 KiB
#18 Accepted 2ms 540.0 KiB
#19 Accepted 2ms 544.0 KiB
#20 Accepted 2ms 328.0 KiB
#21 Accepted 2ms 540.0 KiB
#22 Wrong Answer 2ms 584.0 KiB
#23 Accepted 2ms 540.0 KiB
#24 Wrong Answer 2ms 580.0 KiB

Code

//SUST_ZadeedBoss_Fanclub
//code_korlei_life_ase
//na_korle_lifeNai

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using o_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define double long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); 

void solve ()
{

	int n; cin >>n;
	vector <pair <int, int>> inp(n);
	for (auto &it : inp)
	{
		cin >>it.first >>it.second;
	}
	int x, y; cin >>x >>y;
	int cnt = 0;
	bool hobe = 1;
	for (auto &it : inp)
	{
		if (it.first == x && it.second == y) hobe = 0;
	}
	for (int i=0; i<n; i++)
	{
		int a1 = inp[i].first, b1 = inp[i].second;
		int a2 = inp[(i+1)%n].first, b2 = inp[(i+1)%n].second;
		if (b1 == y || b2 == y) {cnt++; continue;}
		if (min(b1, b2) < y && max(b1, b2) > y)
		{
			int db = b2 - b1;
			if (db == 0)
			{
				continue;
			}
			int da = a2 - a1;
			int ndb = y - b1;
			if ((da * ndb) % db == 0 && a1 + (da * ndb) / db == x) {hobe = 0; break; }
			int nda = da * ndb / db;
			if (db * nda < da * ndb) nda++;
			if (a1 + nda > x) cnt++;
		}

	}
	if (!hobe) cnt = 0;
	if (cnt &1) cout <<"YES\n";
	else cout <<"NO\n";



}

signed main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	int TCASE = 1;
	// cin >> TCASE;

	for (int tcase = 1; tcase <= TCASE; tcase++)
	{
		solve();
	}

}

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 07:09:36
Judged At
2024-12-09 07:09:36
Judged By
Score
83
Total Time
2ms
Peak Memory
584.0 KiB