Submission #1570853
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
#define addm(X, Y) ((X) = ((X) + (Y) % mod) % mod)
double x[3], y[3];
double e[3];
double cs[3];
double ang[3];
bool inside(double r) {
rep(i, 3) {
double xx1,xx2;
xx1 = r / tan(ang[i]); xx2 = r / tan(ang[(i + 1) % 3]);
if (xx1 + xx2 + 2 * r + 1e-14 <= e[(i + 2) % 3]) {
return true;
}
}
return false;
}
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
rep(i, 3) cin >> x[i] >> y[i];
rep(i, 3) e[i] = sqrt(pow(abs(x[(i + 1) % 3] - x[i]), 2) + pow(abs(y[(i + 1) % 3] - y[i]), 2));
rep(i, 3) {
cs[i] = (pow(e[(i + 2) % 3], 2) + pow(e[(i + 1) % 3], 2) - pow(e[i], 2)) / (2 * e[(i + 1) % 3] * e[(i + 2) % 3]);
ang[i] = acos(cs[i]) / 2;
}
double l = 0;
double r = 100000;
rep(i, 100) {
double m = (r + l) / 2;
if (inside(m)) l = m;
else r = m;
}
cout << fixed << setprecision(12) << l << endl;
}
Submission Info
Submission Time |
|
Task |
B - Inscribed Bicycle |
User |
roto_37 |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
2127 Byte |
Status |
AC |
Exec Time |
4 ms |
Memory |
512 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 |
4 ms |
512 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 |