結果

問題 No.2790 Athena 3
ユーザー 2000 Ekiben2000 Ekiben
提出日時 2024-06-21 21:28:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 892 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-21 21:28:57
合計ジャッジ時間 1,435 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 32 ms
10,880 KB
testcase_06 AC 33 ms
10,752 KB
testcase_07 AC 32 ms
10,752 KB
testcase_08 AC 32 ms
10,752 KB
testcase_09 AC 32 ms
10,752 KB
testcase_10 AC 31 ms
10,752 KB
testcase_11 AC 31 ms
10,752 KB
testcase_12 AC 32 ms
10,752 KB
testcase_13 AC 31 ms
10,880 KB
testcase_14 AC 30 ms
10,880 KB
testcase_15 AC 32 ms
10,752 KB
testcase_16 AC 31 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def triangle(x1, y1, x2, y2, x3, y3):
    return abs(x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2)) / 2

def maxtring(x1, y1, x2, y2, x3, y3):
    maxa = 0
    
    for op1 in [0, 1, 2, 3, 4]:
        for op2 in [0, 1, 2, 3, 4]:
            for op3 in [0, 1, 2, 3, 4]:
                new_x1, new_y1 = apply(x1, y1, op1)
                new_x2, new_y2 = apply(x2, y2, op2)
                new_x3, new_y3 = apply(x3, y3, op3)
                
                area = triangle(new_x1, new_y1, new_x2, new_y2, new_x3, new_y3)
                maxa = max(maxa, area)
    
    return maxa

def apply(x, y, op):
    if op == 1:
        return x + 1, y
    elif op == 2:
        return x - 1, y
    elif op == 3:
        return x, y + 1
    elif op == 4:
        return x, y - 1
    else:
        return x, y

x1, y1, x2, y2, x3, y3 = map(int, input().split())
res = maxtring(x1, y1, x2, y2, x3, y3)
print(res)
0