Submission #4086834
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll)1e15;
double getR(double a, double b, double c, double tana, double tanb, double S)
{
double ok = 0, ng = a;
REP(i, 50)
{
double r = (ok + ng) * 0.5;
double n = r / tana, m = r / tanb;
double h = 2 * S / a;
double ts = b * r * 0.5 + c * r * 0.5 + (h - r) * r + r * 2 * r + n * r * 0.5 + m * r * 0.5;
if (n + m + 2 * r > a || ts > S)
{
ng = r;
}
else
{
ok = r;
}
}
return ok;
}
int main()
{
pll A, B, C;
cin >> A.first >> A.second;
cin >> B.first >> B.second;
cin >> C.first >> C.second;
double AB = sqrt(pow(A.first - B.first, 2) + pow(A.second - B.second, 2));
double BC = sqrt(pow(C.first - B.first, 2) + pow(C.second - B.second, 2));
double CA = sqrt(pow(A.first - C.first, 2) + pow(A.second - C.second, 2));
double s = 0.5 * (AB + BC + CA);
double S = sqrt(s * (s - AB) * (s - BC) * (s - CA));
double tanA = tan(asin(2 * S / (AB * CA)) * 0.5);
double tanB = tan(asin(2 * S / (BC * AB)) * 0.5);
double tanC = tan(asin(2 * S / (BC * CA)) * 0.5);
double mr = 0;
mr = std::max(mr, getR(AB, BC, CA, tanA, tanB, S));
mr = std::max(mr, getR(BC, CA, AB, tanB, tanC, S));
mr = std::max(mr, getR(CA, AB, BC, tanC, tanA, S));
cout << OF64 << mr << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Inscribed Bicycle |
User |
coco18000 |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
1690 Byte |
Status |
AC |
Exec Time |
6 ms |
Memory |
640 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
500 / 500 |
Status |
|
|
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 |
6 ms |
640 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 |