Submission #1835121


Source Code Expand

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
using namespace std;
template <class T> inline void setmax(T & a, T const & b) { a = max(a, b); }

double solve1(int x1, int y1, int x2, int y2, int x3, int y3) {
    complex<double> a1(x1 - x3, y1 - y3);
    complex<double> a2(x2 - x3, y2 - y3);
    double arg1 = abs(arg(a1 / a2));
    double arg2 = M_PI - abs(arg((a1 - a2) / a2));
    double scale = abs(a2);
    return scale / (2 + 1 / tan(arg1 / 2) + 1 / tan(arg2 / 2));
}

int main() {
    // input
    int x1, y1; scanf("%d%d", &x1, &y1);
    int x2, y2; scanf("%d%d", &x2, &y2);
    int x3, y3; scanf("%d%d", &x3, &y3);
    // solve
    double result = 0;
    setmax(result, solve1(x1, y1, x2, y2, x3, y3));
    setmax(result, solve1(x2, y2, x3, y3, x1, y1));
    setmax(result, solve1(x3, y3, x1, y1, x2, y2));
    // output
    printf("%.12lf\n", result);
    return 0;
}

Submission Info

Submission Time
Task B - Inscribed Bicycle
User kimiyuki
Language C++14 (GCC 5.4.1)
Score 500
Code Size 938 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:19:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int x1, y1; scanf("%d%d", &x1, &y1);
                                        ^
./Main.cpp:20:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int x2, y2; scanf("%d%d", &x2, &y2);
                                        ^
./Main.cpp:21:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     int x3, y3; scanf("%d%d", &x3, &y3);
                                        ^

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 1 ms 128 KB
001.txt AC 1 ms 128 KB
002.txt AC 1 ms 128 KB
003.txt AC 1 ms 128 KB
004.txt AC 1 ms 128 KB
005.txt AC 1 ms 128 KB
006.txt AC 1 ms 128 KB
007.txt AC 1 ms 128 KB
008.txt AC 1 ms 128 KB
009.txt AC 1 ms 128 KB
010.txt AC 1 ms 128 KB
011.txt AC 1 ms 128 KB
012.txt AC 1 ms 128 KB
013.txt AC 1 ms 128 KB
014.txt AC 1 ms 256 KB
015.txt AC 1 ms 128 KB
example0.txt AC 1 ms 128 KB
example1.txt AC 1 ms 128 KB