Submission #4982217
Source Code Expand
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
using namespace std;
template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
typedef pair<double,double> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;
const int MAX_N = 100005;
const double PI = 3.14159265358979323846;
P rot(P x, double th)
{
return P(x.fi*cos(th)-x.se*sin(th), x.fi*sin(th)+x.se*cos(th));
}
double dir(P p, P q)
{
return sqrt((p.fi-q.fi)*(p.fi-q.fi)+(p.se-q.se)*(p.se-q.se));
}
double solve(P p, P q, P r)
{
q.fi -= p.fi, q.se -= p.se, r.fi -= p.fi, r.se -= p.se;
p = P(0.0, 0.0);
double th;
if(abs(q.fi) < EPS){
if(q.se > 0){
th = - PI / 2.0;
}else{
th = PI / 2.0;
}
}else{
th = -atan(q.se/q.fi);
}
q = rot(q, th), r = rot(r, th);
return abs(q.fi)*abs(r.se)/(dir(p,q)+dir(q,r)+dir(r,p)+2*abs(r.se));
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
P p, q, r;
cin >> p.fi >> p.se;
cin >> q.fi >> q.se;
cin >> r.fi >> r.se;
printf("%.12lf\n", max({solve(p,q,r),solve(q,r,p),solve(r,p,q)}));
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Inscribed Bicycle |
User |
kopricky |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
2543 Byte |
Status |
AC |
Exec Time |
3 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 |
3 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 |