Submission #24974571


Source Code Expand

#include "bits/stdc++.h"

#define int long long

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 1000000007;
using ld = long double;
ld EPS = 1e-8;
ld PI = 3.14159265358979;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N; cin >> N;
	vector<ld>X(N), Y(N);
	for (int i = 0; i < N; i++)cin >> X[i] >> Y[i];
	ld ans = 0;
	for (int i = 0; i < N; i++) {
		vector<pair<ld, ld>>p;
		for (int j = 0; j < N; j++) {
			p.push_back({X[j] - X[i], Y[j] - Y[i]});
		}
		vector<pair<ld, int>>now;
		for (int j = 0; j < N; j++) {
			ld t = atan2l(p[j].second, p[j].first);
			t *= 180.0; t /= PI;
			if (t + EPS < 0)t += 360.0;
			now.push_back({ t, j });
		}
		sort(now.begin(), now.end());
		for (int j = 0; j < N; j++) {
			if (i == now[j].second)continue;
			ld tmp = now[j].first + 180.0;
			if (tmp - EPS > 360.0)tmp -= 360.0;
			pair<ld, int>tmp2 = { tmp, -INF };
			int idx = lower_bound(now.begin(), now.end(), tmp2) - now.begin();
			for (int k = idx - 2; k <= idx + 2; k++) {
				int a = k;
				if (a < 0)a += N;
				if (a >= N)a %= N;
				if (now[a].second == i || now[a].second == now[j].second)continue;
				ans = max(ans, min(abs(now[j].first - now[a].first), 360.0 - abs(now[j].first - now[a].first)));

			}
		}
	}
	cout << fixed << setprecision(15) << ans << endl;
	return 0;


}

Submission Info

Submission Time
Task 009 - Three Point Angle(★6)
User Example
Language C++ (GCC 9.2.1)
Score 6
Code Size 1413 Byte
Status AC
Exec Time 820 ms
Memory 4004 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 6 / 6
Status
AC × 4
AC × 29
Set Name Test Cases
Sample Sample_1.txt, Sample_2.txt, Sample_3.txt, Sample_4.txt
All Random_1.txt, Random_2.txt, Random_3.txt, Random_4.txt, Random_5.txt, Random_6.txt, Random_7.txt, Random_8.txt, Regular_Polygon_1.txt, Regular_Polygon_2.txt, Regular_Polygon_3.txt, Regular_Polygon_4.txt, Regular_Polygon_5.txt, Regular_Polygon_6.txt, Regular_Polygon_7.txt, Regular_Polygon_8.txt, Sample_1.txt, Sample_2.txt, Sample_3.txt, Sample_4.txt, Small_1.txt, Small_2.txt, Small_3.txt, Small_4.txt, Small_5.txt, Small_6.txt, Small_7.txt, Small_8.txt, Three_Linear_1.txt
Case Name Status Exec Time Memory
Random_1.txt AC 33 ms 3708 KiB
Random_2.txt AC 416 ms 3840 KiB
Random_3.txt AC 67 ms 3888 KiB
Random_4.txt AC 132 ms 3852 KiB
Random_5.txt AC 337 ms 3884 KiB
Random_6.txt AC 74 ms 3776 KiB
Random_7.txt AC 614 ms 3972 KiB
Random_8.txt AC 820 ms 3936 KiB
Regular_Polygon_1.txt AC 2 ms 3680 KiB
Regular_Polygon_2.txt AC 2 ms 3736 KiB
Regular_Polygon_3.txt AC 284 ms 3840 KiB
Regular_Polygon_4.txt AC 303 ms 3872 KiB
Regular_Polygon_5.txt AC 152 ms 3856 KiB
Regular_Polygon_6.txt AC 520 ms 4004 KiB
Regular_Polygon_7.txt AC 263 ms 3876 KiB
Regular_Polygon_8.txt AC 713 ms 3940 KiB
Sample_1.txt AC 2 ms 3812 KiB
Sample_2.txt AC 2 ms 3720 KiB
Sample_3.txt AC 3 ms 3820 KiB
Sample_4.txt AC 2 ms 3740 KiB
Small_1.txt AC 2 ms 3676 KiB
Small_2.txt AC 2 ms 3724 KiB
Small_3.txt AC 2 ms 3808 KiB
Small_4.txt AC 2 ms 3744 KiB
Small_5.txt AC 2 ms 3676 KiB
Small_6.txt AC 3 ms 3736 KiB
Small_7.txt AC 2 ms 3816 KiB
Small_8.txt AC 2 ms 3736 KiB
Three_Linear_1.txt AC 2 ms 3800 KiB