Submission #1000742


Source Code Expand

#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	vector<int> x(3), y(3);
	rep(i, 3) cin >> x[i] >> y[i];
	vector<double> a(3);
	rep(i, 3) {
		int dx = x[i] - x[(i + 1) % 3];
		int dy = y[i] - y[(i + 1) % 3];
		a[i] = sqrt(dx * dx + dy * dy);
	}
	double s = 0;
	rep(i, 3) s += x[i] * y[(i + 1) % 3] - y[i] * x[(i + 1) % 3];
	s = abs(s);
	double lb = 0, ub = 10000;
	rep(t, 300) {
		double r = (lb + ub) / 2;
		bool ok = false;
		rep(t, 3) {
			double S = 0;
			S += (a[0] + a[1]) * r + (a[2] + r * 2) * r;
			if (s / a[2] - r <= 0) S += 1e18;
			S += (s / a[2] - r) * r * 2;
			if (S <= s) ok = true;
			// rotate(a.begin(), a.begin() + 1, a.end());
		}
		if (ok) lb = r;
		else ub = r;
	}
	printf("%.15f\n", lb);
}

Submission Info

Submission Time
Task B - Inscribed Bicycle
User sugim48
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1445 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 3
WA × 15
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 WA 2 ms 256 KB
001.txt AC 2 ms 256 KB
002.txt WA 2 ms 256 KB
003.txt WA 2 ms 256 KB
004.txt WA 2 ms 256 KB
005.txt WA 2 ms 256 KB
006.txt WA 2 ms 256 KB
007.txt WA 2 ms 256 KB
008.txt WA 2 ms 256 KB
009.txt WA 2 ms 256 KB
010.txt WA 2 ms 256 KB
011.txt WA 2 ms 256 KB
012.txt WA 2 ms 256 KB
013.txt WA 2 ms 256 KB
014.txt WA 2 ms 256 KB
015.txt WA 2 ms 256 KB
example0.txt AC 2 ms 256 KB
example1.txt AC 2 ms 256 KB