結果

問題 No.1597 Matrix Sort
ユーザー kamomekamome
提出日時 2021-07-09 23:10:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 589 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 682,268 KB
最終ジャッジ日時 2023-09-14 10:41:39
合計ジャッジ時間 7,106 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
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 = list(map(int, input().split()))
B = list(map(int, input().split()))

s = [0]*(10**7+1)
t = [0]*(10**7+1)

fft_len = 2**24
for a in A:
    s[a] += 1
for b in B:
    t[b] += 1

s = np.array(s, dtype=np.int32)
t = np.array(t, dtype=np.int32)

Fs = np.fft.rfft(s, fft_len)
Ft = np.fft.rfft(t, fft_len)
Fst = Fs*Ft
st = np.fft.irfft(Fst, fft_len)
st = list(np.rint(st))

ans = [0]*P

for i, v in enumerate(st):
    ans[i % P] += int(v)

cnt = 0
for i in range(P):
    cnt += int(ans[i])
    if cnt >= K:
        print(i)
        break
0