結果

問題 No.245 貫け!
ユーザー rlangevinrlangevin
提出日時 2023-10-23 12:31:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 821 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 75,944 KB
最終ジャッジ日時 2023-10-23 12:31:30
合計ジャッジ時間 3,208 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,640 KB
testcase_01 AC 37 ms
53,640 KB
testcase_02 AC 36 ms
53,640 KB
testcase_03 AC 36 ms
53,640 KB
testcase_04 AC 38 ms
53,640 KB
testcase_05 AC 37 ms
53,640 KB
testcase_06 AC 47 ms
58,788 KB
testcase_07 AC 36 ms
53,640 KB
testcase_08 AC 59 ms
70,576 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 137 ms
75,876 KB
testcase_16 WA -
testcase_17 AC 144 ms
75,908 KB
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
X = []
a, b, c, d = [-1] * N, [-1] * N, [-1] * N, [-1] * N
for i in range(N):
    a[i], b[i], c[i], d[i] = map(int, input().split())
    X.append((a[i], b[i]))
    X.append((c[i], d[i]))

def f(x1, y1, x2, y2, x3, y3):
    x12 = x2 - x1
    x13 = x3 - x1
    y12 = y2 - y1
    y13 = y3 - y1
    return x12 * y13 - x13 * y12

def solve(x1, y1, x2, y2, x3, y3, x4, y4):
    if f(x1, y1, x2, y2, x3, y3) * f(x1, y1, x2, y2, x4, y4) > 0:
        return 0
    if f(x3, y3, x4, y4, x1, y1) * f(x3, y3, x4, y4, x2, y2) > 0:
        return 0
    return 1

ans = 0
for i in range(2 * N):
    for j in range(i + 1, 2 * N):
        x1, y1 = X[i]
        x2, y2 = X[j]
        val = 0
        for k in range(N):
            val += solve(x1, y1, x2, y2, a[k], b[k], c[k], d[k])
        ans = max(ans, val)

print(ans)
0