Submission #1835075


Source Code Expand

#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
using namespace std;

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
    // // remove x3, y3
    complex<long double> a1(x1 - x3, y1 - y3);
    complex<long double> a2(x2 - x3, y2 - y3);
    // // remove a2
    auto b3 = a1 - a2;
    if (abs(b3) > abs(a1) and abs(b3) > abs(a2)) {
        a2 = b3;
        a1 *= -1;
    } else if (abs(a1) > abs(a2)) {
        swap(a1, a2);
    }
    auto a = a1 / a2;
    long double scale = abs(a2);
    if (arg(a) < 0) {
        a = conj(a);
    }
    // // calculate result
    long double arg1 = arg(a);
    long double arg2 = M_PI - arg(a - complex<long double>(1, 0));
    long double result = scale / (2 + 1 / tan(arg1 / 2) + 1 / tan(arg2 / 2));
    // 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 0
Code Size 973 Byte
Status WA
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:9: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:10: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:11: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 0 / 500
Status
AC × 2
AC × 10
WA × 8
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 WA 1 ms 128 KB
003.txt AC 1 ms 128 KB
004.txt WA 1 ms 128 KB
005.txt AC 1 ms 128 KB
006.txt WA 1 ms 128 KB
007.txt AC 1 ms 128 KB
008.txt WA 1 ms 128 KB
009.txt WA 1 ms 128 KB
010.txt AC 1 ms 128 KB
011.txt AC 1 ms 128 KB
012.txt WA 1 ms 128 KB
013.txt WA 1 ms 128 KB
014.txt AC 1 ms 128 KB
015.txt WA 1 ms 128 KB
example0.txt AC 1 ms 128 KB
example1.txt AC 1 ms 128 KB