Problem:
Max Score: $850$ Points

Problem statement

There is a circle which radius is 1.

There are $N$ vertices on the circle's circumference.

The vertices divides into $N$ equal parts over the circumference.

You can choose $3$ distinct vertices, and you can make a triangle.

There are $\frac{N(N - 1)(N - 2)}{6}$ ways choosing vertices.
The question is: Calculate the area of $K$-th smallest triangle in $\frac{N(N-1)(N-2)}{6}$ triangles.

If the area is same, you can order in any order.

If $N = 4, K = 3$, the result is following:

If you select vertices $1$, $2$, and $3$, the area of triangle $= 1$.

If you select vertices $1$, $2$, and $4$, the area of triangle $= 1$.

If you select vertices $1$, $3$, and $4$, the area of triangle $= 1$.

If you select vertices $2$, $3$, and $4$, the area of triangle $= 1$.

As a result, the 3rd smallest triangle's area $= 1$.

Input

The input is given from Standard Input in the following format:

$N \ K$

Output

Please output the $K$-th triangle area.

Print a floating number denoting the answer. The relative or absolute error of your answer should not be higher than $10^{−9}$.

Constraints

$3 \le N \le 200,000$

$1 \le K \le \frac{N(N-1)(N-2)}{6}$

Subtasks

Subtask 1 [ $160$ points ]

$N \le 100$

Subtask 2 [ $240$ points ]

$N \le 1000$

Subtask 3 [ $450$ points ]

$N \le 200,000$

Sample Input 1

4 3

Sample Output 1

1.0000000000000

This example is already explained in the problem statement.

Sample Input 2

6 9

Sample Output 2

0.86602540378

There are $6$ ways to choose a triangle which area is $\frac{\sqrt{3}}{4}$.

There are $10$ ways to choose a triangle which area is $\frac{\sqrt{3}}{2}$.

There are $2$ ways to choose a triangle which area is $\frac{3 \sqrt{3}}{4}$.

Therefore, the 9th smallest triangle's area is $\frac{\sqrt{3}}{2}$.

Sample Input 3

12 220

Sample Output 3

1.29903810568

Writer: E869120

Solution in C++14 (GCC 5.4.1) (judge verdict: Time Limit Exceeded)

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <functional>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#define PI 3.14159265358979
#define EPS 1e-15

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int n;
ll K;

double calc_area(int i,int j)//i+j<N
{
	double a=sin(2.0*PI*(double) i/(double) n);
	double b=sin(2.0*PI*(double) j/(double) n);
	double c=sin(2.0*PI*(double) (n-i-j)/(double) n);/*
	if(2*i>=n) a*=-1;
	if(2*j>=n) b*=-1;
	if(2*(n-i-j)>=n) c*=-1;*/
	//if(i==0) printf("%d %f %f %f\n",j,a,b,c);
	return (a+b+c)/2.0;
}
int count(int i,double X)
{
	if(i==n-1) return 0;
	int all=(n-i)/2;
	int l=0,r=all+1;
	while(r-l>1)
	{
		int m=(l+r)/2;
		if(calc_area(i,m)>X+EPS) r=m;
		else l=m;
	}
	if(r==all+1) return n-i-1;
	return l*2;
}
bool check(double X)
{
	//X=1.0;
	ll sum=0;
	for(int i=1;i<n;i++) sum+=count(i,X);
	//for(int i=0;i<n;i++) printf("%d ",count(i,X));
	//puts("");
	//return 0;
	return sum*(ll) n>=K;
}
int main()
{
	scanf("%d %lld",&n,&K);
	K=3LL*K;
	//check(0);
	//return 0;
	double l=0.0,r=2.0*PI;
	for(int i=0;i<50;i++)
	{
		double m=(l+r)/2;
		if(check(m)) r=m;
		else l=m;
	}
	printf("%.10f\n",r);
	return 0;
}