結果

問題 No.245 貫け!
ユーザー convexineqconvexineq
提出日時 2021-01-02 13:08:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 199 ms / 5,000 ms
コード長 531 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-20 07:44:07
合計ジャッジ時間 3,390 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
51,584 KB
testcase_01 AC 44 ms
52,224 KB
testcase_02 AC 45 ms
51,968 KB
testcase_03 AC 43 ms
52,352 KB
testcase_04 AC 44 ms
51,968 KB
testcase_05 AC 44 ms
52,224 KB
testcase_06 AC 45 ms
52,608 KB
testcase_07 AC 44 ms
52,096 KB
testcase_08 AC 69 ms
65,536 KB
testcase_09 AC 112 ms
76,288 KB
testcase_10 AC 114 ms
76,288 KB
testcase_11 AC 147 ms
76,360 KB
testcase_12 AC 186 ms
76,672 KB
testcase_13 AC 195 ms
76,188 KB
testcase_14 AC 196 ms
76,532 KB
testcase_15 AC 199 ms
76,244 KB
testcase_16 AC 184 ms
76,060 KB
testcase_17 AC 194 ms
76,160 KB
testcase_18 AC 185 ms
76,324 KB
testcase_19 AC 186 ms
76,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_opposit(p0,p1,p2,p3):
    x0,y0 = p0; x1,y1 = p1; x2,y2 = p2; x3,y3 = p3
    return ((x0-x1)*(y2-y0)+(y0-y1)*(x0-x2))*((x0-x1)*(y3-y0)+(y0-y1)*(x0-x3)) <= 0

n = int(input())
pts = []
lines = []
for _ in range(n):
    a,b,c,d = map(int,input().split())
    lst = [(a,b),(c,d)]
    pts += lst
    lines += [lst]

ans = 0
L = len(pts)
for i in range(L):
    for j in range(i+1,L):
        if pts[i] == pts[j]: continue
        v = sum(is_opposit(pts[i],pts[j],p,q) for p,q in lines)
        ans = max(v,ans)        
print(ans)
0