結果
問題 | No.245 貫け! |
ユーザー |
![]() |
提出日時 | 2020-01-30 16:50:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,395 ms / 5,000 ms |
コード長 | 1,457 bytes |
コンパイル時間 | 300 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-09-16 03:39:44 |
合計ジャッジ時間 | 13,114 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
import syssys.setrecursionlimit(10 ** 6)from bisect import *from collections import *from heapq import *int1 = lambda x: int(x) - 1p2D = lambda x: print(*x, sep="\n")def II(): return int(sys.stdin.readline())def SI(): return sys.stdin.readline()[:-1]def MI(): return map(int, sys.stdin.readline().split())def MI1(): return map(int1, sys.stdin.readline().split())def MF(): return map(float, sys.stdin.readline().split())def LI(): return list(map(int, sys.stdin.readline().split()))def LI1(): return list(map(int1, sys.stdin.readline().split()))def LF(): return list(map(float, sys.stdin.readline().split()))def LLI(rows_number): return [LI() for _ in range(rows_number)]dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]def main():def cross(x1,x2,y1,y2,k):vx,vy=x2-x1,y2-y1x3,y3,x4,y4=lines[k]vx3,vy3=x3-x1,y3-y1vx4,vy4=x4-x1,y4-y1if (vx*vy3-vy*vx3)*(vx*vy4-vy*vx4)>0:return 0else:return 1n=II()if n==1:print(1)exit()lines=[LI() for _ in range(n)]ans=0for i in range(n-1):l1=lines[i]for j in range(i+1,n):l2=lines[j]for p,q in [(0,0),(0,1),(1,0),(1,1)]:x1,y1=l1[p*2],l1[p*2+1]x2,y2=l2[q*2],l2[q*2+1]if (x1,y1)==(x2,y2):continuecur=sum(cross(x1,x2,y1,y2,k) for k in range(n))if cur>ans:ans=curprint(ans)main()