結果

問題 No.1041 直線大学
ユーザー maspymaspy
提出日時 2020-05-01 22:14:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,004 KB
実行使用メモリ 37,968 KB
最終ジャッジ日時 2023-08-26 14:27:36
合計ジャッジ時間 8,052 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
29,856 KB
testcase_01 AC 135 ms
29,840 KB
testcase_02 AC 134 ms
29,876 KB
testcase_03 AC 134 ms
29,888 KB
testcase_04 AC 134 ms
29,860 KB
testcase_05 AC 132 ms
29,804 KB
testcase_06 AC 134 ms
29,828 KB
testcase_07 AC 132 ms
30,036 KB
testcase_08 AC 134 ms
29,988 KB
testcase_09 AC 136 ms
30,084 KB
testcase_10 AC 169 ms
37,836 KB
testcase_11 AC 147 ms
37,968 KB
testcase_12 AC 149 ms
37,880 KB
testcase_13 AC 136 ms
29,980 KB
testcase_14 AC 142 ms
33,692 KB
testcase_15 AC 140 ms
30,876 KB
testcase_16 AC 138 ms
32,796 KB
testcase_17 AC 136 ms
29,928 KB
testcase_18 AC 139 ms
30,968 KB
testcase_19 AC 136 ms
32,688 KB
testcase_20 AC 132 ms
29,848 KB
testcase_21 AC 134 ms
31,396 KB
testcase_22 AC 135 ms
29,852 KB
testcase_23 AC 143 ms
36,780 KB
testcase_24 AC 140 ms
33,480 KB
testcase_25 AC 137 ms
31,508 KB
testcase_26 AC 135 ms
30,028 KB
testcase_27 AC 137 ms
30,636 KB
testcase_28 AC 133 ms
29,812 KB
testcase_29 AC 134 ms
29,908 KB
testcase_30 AC 132 ms
29,876 KB
testcase_31 AC 133 ms
29,928 KB
testcase_32 AC 133 ms
29,804 KB
testcase_33 AC 132 ms
29,848 KB
testcase_34 AC 132 ms
29,848 KB
testcase_35 AC 132 ms
29,792 KB
testcase_36 AC 133 ms
29,884 KB
testcase_37 AC 132 ms
29,872 KB
testcase_38 AC 145 ms
37,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
XY = np.array(read().split(), np.int32)
X = XY[::2]
Y = XY[1::2]

a = np.subtract.outer(Y, Y)
b = -np.subtract.outer(X, X)
c = a * X + b * Y

a = a.ravel()
b = b.ravel()
c = c.ravel()
ind = ~((a == 0) & (b == 0))
a = a[ind]
b = b[ind]
c = c[ind]

on_line = np.multiply.outer(a, X) + np.multiply.outer(b, Y) - c[:,None] == 0

cnt = on_line.sum(axis=1)
print(cnt.max())
0