Submission #2368765


Source Code Expand

#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

const long double eps = 0.0000000001;
std::vector<long double>x(3), y(3), edge(3);
long double r1, r2;

long double triangleS(long double px1, long double py1, long double px2, long double py2, long double px3, long double py3)
{
	return abs((px1 - px3)*(py2 - py3) - (px2 - px3)*(py1 - py3)) / 2.;
}

bool check(long double x)
{
	r2 = r1 - x;
	auto ll = edge[2] * r2 / r1;
	return ll >= x * 2;
}

int main()
{
	rep(i, 3) in >> x[i] >> y[i];
	rep(i, 3) edge[i] = sqrt((x[i] - x[(i + 1) % 3])*(x[i] - x[(i + 1) % 3]) + (y[i] - y[(i + 1) % 3])*(y[i] - y[(i + 1) % 3]));
	std::sort(edge.begin(), edge.end());
	r1 = 2. * triangleS(x[0], y[0], x[1], y[1], x[2], y[2]) / (edge[0] + edge[1] + edge[2]);
	long double l = 0., r = 114514.;
	while (r - l > eps)
	{
		auto m = (r + l) / 2;
		if (check(m)) l = m;
		else r = m;
	}
	out << std::fixed << std::setprecision(12);
	out << l << std::endl;
	return 0;
}

Submission Info

Submission Time
Task B - Inscribed Bicycle
User Bwambocos
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1071 Byte
Status AC
Exec Time 2 ms
Memory 384 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 18
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 2 ms 384 KB
001.txt AC 1 ms 256 KB
002.txt AC 1 ms 256 KB
003.txt AC 1 ms 256 KB
004.txt AC 1 ms 256 KB
005.txt AC 1 ms 256 KB
006.txt AC 1 ms 256 KB
007.txt AC 1 ms 256 KB
008.txt AC 1 ms 256 KB
009.txt AC 1 ms 256 KB
010.txt AC 1 ms 256 KB
011.txt AC 1 ms 256 KB
012.txt AC 1 ms 256 KB
013.txt AC 1 ms 256 KB
014.txt AC 1 ms 256 KB
015.txt AC 1 ms 256 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB