結果

問題 No.245 貫け!
ユーザー lloyzlloyz
提出日時 2023-11-16 02:15:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 5,000 ms
コード長 607 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 66,392 KB
最終ジャッジ日時 2023-11-16 02:15:55
合計ジャッジ時間 2,805 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 35 ms
53,460 KB
testcase_04 AC 39 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 36 ms
53,460 KB
testcase_08 AC 47 ms
62,232 KB
testcase_09 AC 55 ms
64,324 KB
testcase_10 AC 58 ms
64,324 KB
testcase_11 AC 67 ms
64,320 KB
testcase_12 AC 96 ms
66,392 KB
testcase_13 AC 97 ms
66,392 KB
testcase_14 AC 99 ms
66,392 KB
testcase_15 AC 94 ms
66,392 KB
testcase_16 AC 95 ms
66,392 KB
testcase_17 AC 96 ms
66,384 KB
testcase_18 AC 95 ms
66,392 KB
testcase_19 AC 96 ms
66,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
P = []
for _ in range(n):
    a, b, c, d = map(int, input().split())
    P.append((a, b))
    P.append((c, d))

ans = 0
m = 2 * n
for i in range(m):
    x1, y1 = P[i]
    for j in range(i + 1, m):
        x2, y2 = P[j]
        if x1 == x2 and y1 == y2:
            continue
        res = 0
        for i in range(0, m, 2):
            a, b = P[i]
            c, d = P[i + 1]
            e1 = (x2 - x1) * (b - y1) - (y2 - y1) * (a - x1)
            e2 = (x2 - x1) * (d - y1) - (y2 - y1) * (c - x1)
            if e1 * e2 <= 0:
                res += 1
        ans = max(ans, res)
print(ans)
0