結果

問題 No.245 貫け!
ユーザー titiatitia
提出日時 2022-08-11 00:45:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 11,824 KB
実行使用メモリ 10,168 KB
最終ジャッジ日時 2023-10-21 09:09:34
合計ジャッジ時間 9,946 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,144 KB
testcase_01 AC 29 ms
10,144 KB
testcase_02 AC 29 ms
10,144 KB
testcase_03 AC 29 ms
10,144 KB
testcase_04 AC 28 ms
10,144 KB
testcase_05 AC 33 ms
10,144 KB
testcase_06 WA -
testcase_07 AC 28 ms
10,144 KB
testcase_08 AC 39 ms
10,144 KB
testcase_09 AC 86 ms
10,148 KB
testcase_10 AC 111 ms
10,148 KB
testcase_11 AC 363 ms
10,152 KB
testcase_12 AC 947 ms
10,156 KB
testcase_13 AC 951 ms
10,156 KB
testcase_14 AC 939 ms
10,156 KB
testcase_15 AC 946 ms
10,156 KB
testcase_16 AC 937 ms
10,156 KB
testcase_17 AC 941 ms
10,156 KB
testcase_18 AC 931 ms
10,156 KB
testcase_19 AC 952 ms
10,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 交差判定には外積を使うんだったよなー、と思って解説を見た。

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)

print(ANS)
            
0