結果

問題 No.1041 直線大学
ユーザー maspymaspy
提出日時 2020-05-01 22:14:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 572 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 52,272 KB
最終ジャッジ日時 2024-04-28 00:13:53
合計ジャッジ時間 21,339 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 469 ms
44,216 KB
testcase_01 AC 446 ms
44,212 KB
testcase_02 AC 440 ms
44,340 KB
testcase_03 AC 449 ms
44,084 KB
testcase_04 AC 450 ms
44,604 KB
testcase_05 AC 449 ms
44,220 KB
testcase_06 AC 450 ms
44,212 KB
testcase_07 AC 455 ms
44,336 KB
testcase_08 AC 452 ms
44,596 KB
testcase_09 AC 451 ms
44,336 KB
testcase_10 AC 572 ms
52,152 KB
testcase_11 AC 452 ms
52,148 KB
testcase_12 AC 465 ms
52,272 KB
testcase_13 AC 451 ms
44,216 KB
testcase_14 AC 442 ms
47,924 KB
testcase_15 AC 441 ms
44,592 KB
testcase_16 AC 451 ms
47,288 KB
testcase_17 AC 450 ms
44,344 KB
testcase_18 AC 439 ms
44,848 KB
testcase_19 AC 449 ms
47,032 KB
testcase_20 AC 442 ms
44,600 KB
testcase_21 AC 447 ms
44,720 KB
testcase_22 AC 446 ms
44,592 KB
testcase_23 AC 455 ms
51,436 KB
testcase_24 AC 448 ms
48,056 KB
testcase_25 AC 441 ms
45,116 KB
testcase_26 AC 441 ms
44,596 KB
testcase_27 AC 440 ms
45,112 KB
testcase_28 AC 437 ms
44,596 KB
testcase_29 AC 443 ms
44,340 KB
testcase_30 AC 507 ms
44,468 KB
testcase_31 AC 441 ms
44,604 KB
testcase_32 AC 448 ms
44,592 KB
testcase_33 AC 452 ms
44,728 KB
testcase_34 AC 442 ms
44,460 KB
testcase_35 AC 441 ms
44,380 KB
testcase_36 AC 452 ms
44,476 KB
testcase_37 AC 451 ms
44,096 KB
testcase_38 AC 455 ms
52,184 KB
testcase_39 AC 447 ms
44,596 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