結果

問題 No.245 貫け!
コンテスト
ユーザー lloyz
提出日時 2023-11-16 02:15:52
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 65 ms / 5,000 ms
+ 492µs
コード長 607 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,059 ms
コンパイル使用メモリ 64,384 KB
実行使用メモリ 58,800 KB
最終ジャッジ日時 2026-12-01 23:22:23
合計ジャッジ時間 4,269 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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