Submission #1000698
Source Code Expand
#ifdef DEBUG #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; #ifdef DEBUG #define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr) #else #define eprintf(...) ; #endif #define pb push_back #define mp make_pair #define sz(x) ((int) (x).size()) #define TASK "text" const int inf = (int) 1.01e9; const ld eps = 1e-9; const ld pi = acos((ld) -1); mt19937 mrand(random_device{} ()); int rnd(int x) { return mrand() % x; } void precalc() { } struct point { ld x, y; point() {} point(ld _x, ld _y): x(_x), y(_y) {} bool read() { double xx, yy; if (scanf("%lf%lf", &xx, &yy) < 2) { return false; } x = xx; y = yy; return true; } point operator - (const point &p) const { return point(x - p.x, y - p.y); } ld operator ^ (const point &p) const { return x * p.y - y * p.x; } ld slen() const { return x * x + y * y; } ld len() const { return sqrt(slen()); } }; point a, b, c; int read() { if (!a.read() || !b.read() || !c.read()) { return false; } return true; } void solve() { ld s = abs((b - a) ^ (c - a)); ld ha = s / (c - b).len(), hb = s / (a - c).len(), hc = s / (b - a).len(); ld len = max((b - a).len(), max((c - b).len(), (a - c).len())); ld l = 0, r = 1e4; for (int it = 0; it < 200; it++) { ld m = (l + r) / 2; if (m > hc - eps) { r = m; } ld kc = (hc - m) / hc; ld hb0 = hb * kc; if (m > hb0 - eps) { r = m; } ld kb = kc * (hb0 - m) / hb0; ld ha0 = ha * kb; if (m > ha0 - eps) { r = m; } ld ka = kb * (ha0 - m) / ha0; if (len * ka < 2 * m) { r = m; } else { l = m; } } printf("%.20f\n", (double) l); } int main() { precalc(); #ifdef LOCAL assert(freopen(TASK ".in", "r", stdin)); assert(freopen(TASK ".out", "w", stdout)); #endif while (true) { if (!read()) { break; } solve(); #ifdef DEBUG eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC); #endif } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Inscribed Bicycle |
User | aid |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 2222 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 256 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 | 3 ms | 256 KB |
001.txt | AC | 3 ms | 256 KB |
002.txt | AC | 3 ms | 256 KB |
003.txt | AC | 3 ms | 256 KB |
004.txt | AC | 3 ms | 256 KB |
005.txt | AC | 3 ms | 256 KB |
006.txt | AC | 3 ms | 256 KB |
007.txt | AC | 3 ms | 256 KB |
008.txt | AC | 3 ms | 256 KB |
009.txt | AC | 3 ms | 256 KB |
010.txt | AC | 3 ms | 256 KB |
011.txt | AC | 3 ms | 256 KB |
012.txt | AC | 3 ms | 256 KB |
013.txt | AC | 3 ms | 256 KB |
014.txt | AC | 3 ms | 256 KB |
015.txt | AC | 3 ms | 256 KB |
example0.txt | AC | 3 ms | 256 KB |
example1.txt | AC | 3 ms | 256 KB |