結果

問題 No.1597 Matrix Sort
ユーザー tktk_snsntktk_snsn
提出日時 2021-07-09 22:09:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 445 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 825,304 KB
最終ジャッジ日時 2023-09-14 09:15:28
合計ジャッジ時間 2,897 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
29,712 KB
testcase_01 AC 134 ms
29,852 KB
testcase_02 AC 137 ms
29,812 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N, K, P = map(int, input().split())
A = np.array(input().split(), dtype=np.int32) % P
B = np.array(input().split(), dtype=np.int32) % P
Fa = np.bincount(A)
Fb = np.bincount(B)

sz = 2 * P
fft_len = 1 << (sz - 1).bit_length()
Ca = np.fft.rfft(Fa, fft_len)
Cb = np.fft.rfft(Fb, fft_len)
G = np.fft.irfft(Ca * Cb, fft_len)[:sz]
G = np.rint(G).astype(np.int64)
G = (G[:P] + G[P:]).cumsum()

ans = np.searchsorted(G, K)
print(ans)
0