結果
問題 | No.245 貫け! |
ユーザー | titia |
提出日時 | 2022-08-11 00:56:15 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,908 ms / 5,000 ms |
コード長 | 804 bytes |
コンパイル時間 | 100 ms |
コンパイル使用メモリ | 11,900 KB |
実行使用メモリ | 10,200 KB |
最終ジャッジ日時 | 2023-10-21 09:17:07 |
合計ジャッジ時間 | 17,327 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,184 KB |
testcase_01 | AC | 30 ms
10,184 KB |
testcase_02 | AC | 30 ms
10,184 KB |
testcase_03 | AC | 29 ms
10,184 KB |
testcase_04 | AC | 30 ms
10,184 KB |
testcase_05 | AC | 30 ms
10,188 KB |
testcase_06 | AC | 30 ms
10,188 KB |
testcase_07 | AC | 30 ms
10,184 KB |
testcase_08 | AC | 47 ms
10,188 KB |
testcase_09 | AC | 140 ms
10,192 KB |
testcase_10 | AC | 191 ms
10,192 KB |
testcase_11 | AC | 687 ms
10,196 KB |
testcase_12 | AC | 1,851 ms
10,200 KB |
testcase_13 | AC | 1,898 ms
10,200 KB |
testcase_14 | AC | 1,861 ms
10,200 KB |
testcase_15 | AC | 1,856 ms
10,200 KB |
testcase_16 | AC | 1,853 ms
10,200 KB |
testcase_17 | AC | 1,908 ms
10,200 KB |
testcase_18 | AC | 1,842 ms
10,200 KB |
testcase_19 | AC | 1,853 ms
10,200 KB |
ソースコード
# 交差判定には外積を使うんだったよなー、と思って解説を見た。 N=int(input()) A=[tuple(map(int,input().split())) for i in range(N)] def outer_product(x,y,z,w): return x*w-y*z ANS=0 for x,y,_,_ in A: for _,_,z,w in A: if x==z and y==w: continue score=0 for p,q,r,s in A: if outer_product(z-x,w-y,p-x,q-y)*outer_product(z-x,w-y,r-x,s-y)<=0: score+=1 ANS=max(ANS,score) for x,y,_,_ in A: for z,w,_,_ in A: if x==z and y==w: continue score=0 for p,q,r,s in A: if outer_product(z-x,w-y,p-x,q-y)*outer_product(z-x,w-y,r-x,s-y)<=0: score+=1 ANS=max(ANS,score) print(ANS)