結果
問題 | No.245 貫け! |
ユーザー |
![]() |
提出日時 | 2020-09-18 22:33:58 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,403 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-06-22 10:02:51 |
合計ジャッジ時間 | 44,357 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 TLE * 7 |
ソースコード
import sysread=sys.stdin.buffer.readreadline=sys.stdin.buffer.readlinereadlines=sys.stdin.buffer.readlinesclass Point:def __init__(self, x, y):self.x=xself.y=ydef __add__(self, other):return Point(self.x+other.x, self.y+other.y)def __sub__(self, other):return Point(self.x-other.x, self.y-other.y)def __mul__(self, other):return Point(self.x*other, self.y*other)def dot(self, other):return self.x*other.x+self.y*other.ydef det(self, other):return self.x*other.y-self.y*other.xdef __eq__(self, other):return self.x==other.x and self.y==other.ydef is_intersect(p, q, r, s):a=(p-q).det(r-s)b=(p-r).det(r-s)if a==0:if b==0:return Trueelse:return Falseif a>0:if 0<=b and b<=a:return Trueelse:return Falseelse:if 0>=b and b>=a:return Trueelse:return Falsen=int(readline())abcd=list(map(int, read().split()))ps=[Point(a, b) for a, b, c, d in zip(*[iter(abcd)]*4)]qs=[Point(c, d) for a, b, c, d in zip(*[iter(abcd)]*4)]pq=ps+qsans=0for i, r in enumerate(pq):for s in pq[:i]:if r==s:continuecnt=sum(is_intersect(p, q, r, s) for p, q in zip(ps, qs))if ans<cnt:ans=cntprint(ans)