Submission #1000808


Source Code Expand

#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const double EPS=1e-12;
const double PI=acos(-1);
struct Point{
    double x,y;
    Point(double _x=0,double _y=0){x=_x;y=_y;}
    Point operator-(const Point& b){return Point(x-b.x,y-b.y);}
    Point operator+(const Point& b){return Point(x+b.x,y+b.y);}
    Point operator*(const double v){return Point(x*v,y*v);}
    double operator*(const Point& b){return x*b.y-y*b.x;}
    double operator^(const Point& b){return x*b.x+y*b.y;}
    bool operator<(const Point& b)const{
        if(fabs(x-b.x)<EPS){
            if(fabs(y-b.y)<EPS)return 0;
            return y<b.y;
        }
        return x<b.x;
    }
    double angle(){return atan2(y,x);}
    double dis(){return sqrt(x*x+y*y);}
    Point rotate(double v){return Point(x*cos(v)-y*sin(v),x*sin(v)+y*cos(v));}
    Point unit(){return (*this)*(1./dis());}
    void scan(){scanf("%lf%lf",&x,&y);}
    void print(){printf("%.9f %.9f\n",x,y);}
}p[3];
Point gg(Point X,Point V1,Point V2,double r){
    double aa=V1.angle()-V2.angle();
    if(aa<0)aa=-aa;
    if(aa>PI)aa=2*PI-aa;
    aa*=0.5;
    double dd=r/sin(aa);
    return X+((V1.unit()+V2.unit()).unit()*dd);
}
double ma;
double f(Point X,Point V1,Point V2,Point Y,Point V3,Point V4){
    double ll=0,rr=ma;
    REP(k,30){
        double mm=(ll+rr)*0.5;
        Point O1=gg(X,V1,V2,mm);
        Point O2=gg(Y,V3,V4,mm);
        if((O1-O2).dis()>mm*2)ll=mm;
        else rr=mm;
    }
    return (ll+rr)*0.5;
}
int main(){
    REP(i,3)p[i].scan();
    VI d[3];
    d[0].PB(1);d[0].PB(2);
    d[1].PB(0);d[1].PB(2);
    d[2].PB(0);d[2].PB(1);
    double a=(p[1]-p[0]).dis();
    double b=(p[2]-p[0]).dis();
    double c=(p[2]-p[1]).dis();
    double s=(a+b+c)*0.5;
    ma=sqrt(s*(s-a)*(s-b)*(s-c))/s;
    double an=0;
    REP(i,3)REP(j,i){
        an=max(an,f(p[i],(p[d[i][0]]-p[i]),(p[d[i][1]]-p[i])
                    ,p[j],(p[d[j][0]]-p[j]),(p[d[j][1]]-p[j])));
    }
    printf("%.12f\n",an);

    return 0;
}

Submission Info

Submission Time
Task B - Inscribed Bicycle
User dreamoon
Language C++14 (GCC 5.4.1)
Score 500
Code Size 3001 Byte
Status AC
Exec Time 3 ms
Memory 384 KB

Compile Error

./Main.cpp: In member function ‘void Point::scan()’:
./Main.cpp:49:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     void scan(){scanf("%lf%lf",&x,&y);}
                                      ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 18
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 384 KB
001.txt AC 3 ms 256 KB
002.txt AC 3 ms 384 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