結果
| 問題 | 
                            No.245 貫け!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             convexineq
                         | 
                    
| 提出日時 | 2021-01-02 12:56:40 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 663 bytes | 
| コンパイル時間 | 427 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 77,736 KB | 
| 最終ジャッジ日時 | 2024-10-12 02:46:21 | 
| 合計ジャッジ時間 | 3,860 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 7 WA * 9 | 
ソースコード
def is_opposit(p0,p1,p2,p3):
    x0,y0 = p0; x1,y1 = p1; x2,y2 = p2; x3,y3 = p3
    if ((x0-x1)*(y2-y0)+(y0-y1)*(x0-x2))*((x0-x1)*(y3-y0)+(y0-y1)*(x0-x3)) > 0:
        return False
    else:
        return True
def is_crossed(p0,p1,p2,p3):
    return is_opposit(p0,p1,p2,p3) and is_opposit(p2,p3,p0,p1)
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_crossed(pts[i],pts[j],p,q) for p,q in lines)
        ans = max(v,ans)
print(ans)
            
            
            
        
            
convexineq