QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102568#5152. Circular Caramel Cookiew4p3r#WA 2ms3580kbC++20715b2023-05-03 14:44:512023-05-03 14:44:52

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 14:44:52]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3580kb
  • [2023-05-03 14:44:51]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
typedef double db;
const db eps=1e-9;
typedef long long ll;

int s=0;

bool check(db mid)
{
	ll cnt=0;
	for(int i=1;i<=mid;i++)
	{
		db d=mid*mid-1ll*i*i;
		// cerr<<"i = "<<i<<", d = "<<d<<": \n";
		int l=0,r=mid+1;
		while(l+1<r)
		{
			// cerr<<l<<" "<<r<<"\n";
			int m=l+r>>1;
			if(1ll*m*m<=d) l=m;
			else r=m;
		}
		cnt+=l;
	}
	// cerr<<"mid = "<<mid<<", cnt = "<<cnt<<"\n";
	return 4*cnt>s;
}

int main()
{
	scanf("%d",&s);
	db l=0,r=sqrt(s);
	while(l+eps<=r)
	{
		db mid=l+(r-l)*0.5;
		// cerr<<l<<" "<<r<<" "<<mid<<": \n";
		if(check(mid)) r=mid;
		else l=mid;
		// cerr<<"\n";
	}
	printf("%.20lf\n",r);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3468kb

input:

11

output:

2.23606797808101553926

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

59

output:

5.00000000031749713969

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3568kb

input:

1

output:

1.00000000000000000000

result:

wrong answer 1st numbers differ - expected: '1.4142136', found: '1.0000000', error = '0.2928932'