/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 352.0 KiB
#3 Wrong Answer 1ms 768.0 KiB
#4 Wrong Answer 1ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define bug(a) cout << #a << " : " << a << endl;

vector<pair<ll,ll>> point;

ll get(){

	ll sum1 = 0, sum2 = 0;
	int n = point.size();
	for(int i = 0; i < n; i++){
		if ( i == n-1 ) {
			sum1 += (1LL * point[i].first * point[0].second);
		}
		else{
			sum1 += (1LL * point[i].first * point[i + 1].second);
		}

		if ( i == n-1 ) {
			sum2 += (1LL * point[i].second * point[0].first);
		} 
		else {
			sum2 += (1LL * point[i].second * point[i + 1].second);
		}
	}
	ll ans = abs(sum1 - sum2);
	return ans;

}

void solve(){
	int n;	cin >> n;

	for(int i = 1; i <= n; i++){
		int x, y;	cin >> x >> y;
		point.push_back({x, y});
	}

	pair<ll,ll> p1;
	cin >> p1.first >> p1.second;

	ll area = get();

	point.push_back(p1);
	ll area_upd = get();

	if ( area_upd > area ) {
		cout << "NO" << '\n';
	}
	else {
		cout << "YES" << '\n';
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int tc = 1, cs = 0;
	// cin >> tc;

	while(tc--){
		//cout << "Case # " << ++cs << ": " ;
		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 06:08:36
Judged At
2024-12-09 06:08:36
Judged By
Score
4
Total Time
2ms
Peak Memory
768.0 KiB