QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#94524#2267. Jewelry Sizewhatever#WA 0ms3908kbC++231.1kb2023-04-06 15:40:302023-04-06 15:40:32

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-06 15:40:32]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3908kb
  • [2023-04-06 15:40:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int n; cin >> n; 
	vector<int> len(n);
	for(auto &x : len) cin >> x;
	sort(len.begin(), len.end());
	constexpr double PI = acos(-1), eps = 1e-8;
	double ans = 1e18;
	cout << fixed << setprecision(10);
	{
		auto check = [&] (double r) {
			double sum = 0;
			for(int i = 0; i < n; i ++) {
				sum += 2 * asin(len[i] / 2.0 / r);
			}
			return sum > 2 * PI - eps;
		};
		double l = len.back() / 2.0, r = 1e18;
		for(int i = 0; i < 140; i ++) {
			double mid = (l + r) / 2;
			if(check(mid)) l = mid;
			else r = mid;
		}
		if(check(l)) ans = min(ans, l);
	}
	{
		auto check = [&] (double r) {
			double sum = 0;
			for(int i = 0; i < n; i ++) {
				sum += 2 * asin(len[i] / 2.0 / r);
			}
			return sum < 4 * asin(len.back() / 2.0 / r) ;
		};
		double l = len.back() / 2.0, r = 1e18;
		for(int i = 0; i < 140; i ++) {
			double mid = (l + r) / 2;
			if(check(mid)) l = mid;
			else r = mid;
		}
		cout << l << ' ' << r << endl;
		if(check(l)) ans = min(ans, l);
	}
	cout  << ans << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3908kb

input:

5
3 1 6 1 7

output:

3.5000000000 3.5000000000
3.5444043530

result:

wrong answer 1st numbers differ - expected: '3.5444044', found: '3.5000000', error = '0.0125280'