結果
問題 | No.245 貫け! |
ユーザー | chocorusk |
提出日時 | 2020-09-18 22:34:15 |
言語 | PyPy3 (7.3.13) |
結果 |
AC
|
実行時間 | 376 ms / 5,000 ms |
コード長 | 1,403 bytes |
コンパイル時間 | 1,494 ms |
コンパイル使用メモリ | 86,780 KB |
実行使用メモリ | 79,720 KB |
最終ジャッジ日時 | 2023-09-04 11:12:10 |
合計ジャッジ時間 | 7,075 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 76 ms
70,544 KB |
testcase_01 | AC | 78 ms
71,000 KB |
testcase_02 | AC | 78 ms
70,372 KB |
testcase_03 | AC | 77 ms
70,996 KB |
testcase_04 | AC | 77 ms
70,616 KB |
testcase_05 | AC | 82 ms
70,996 KB |
testcase_06 | AC | 88 ms
75,184 KB |
testcase_07 | AC | 79 ms
70,688 KB |
testcase_08 | AC | 155 ms
77,584 KB |
testcase_09 | AC | 204 ms
78,788 KB |
testcase_10 | AC | 219 ms
78,248 KB |
testcase_11 | AC | 271 ms
79,008 KB |
testcase_12 | AC | 366 ms
79,648 KB |
testcase_13 | AC | 357 ms
78,884 KB |
testcase_14 | AC | 353 ms
79,144 KB |
testcase_15 | AC | 362 ms
78,632 KB |
testcase_16 | AC | 360 ms
79,164 KB |
testcase_17 | AC | 376 ms
79,468 KB |
testcase_18 | AC | 358 ms
79,720 KB |
testcase_19 | AC | 369 ms
79,640 KB |
ソースコード
import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines class Point: def __init__(self, x, y): self.x=x self.y=y def __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.y def det(self, other): return self.x*other.y-self.y*other.x def __eq__(self, other): return self.x==other.x and self.y==other.y def 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 True else: return False if a>0: if 0<=b and b<=a: return True else: return False else: if 0>=b and b>=a: return True else: return False n=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+qs ans=0 for i, r in enumerate(pq): for s in pq[:i]: if r==s: continue cnt=sum(is_intersect(p, q, r, s) for p, q in zip(ps, qs)) if ans<cnt: ans=cnt print(ans)