結果
| 問題 |
No.245 貫け!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-16 02:15:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 102 ms / 5,000 ms |
| コード長 | 607 bytes |
| コンパイル時間 | 312 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 65,664 KB |
| 最終ジャッジ日時 | 2024-09-26 04:56:09 |
| 合計ジャッジ時間 | 2,571 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
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)