結果

問題 No.2770 Coupon Optimization
ユーザー titiatitia
提出日時 2024-06-03 01:04:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,454 ms / 3,000 ms
コード長 535 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 134,024 KB
最終ジャッジ日時 2024-06-03 01:05:01
合計ジャッジ時間 33,636 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 482 ms
43,972 KB
testcase_01 AC 474 ms
43,348 KB
testcase_02 AC 473 ms
43,952 KB
testcase_03 AC 2,316 ms
134,024 KB
testcase_04 AC 2,308 ms
133,716 KB
testcase_05 AC 540 ms
44,656 KB
testcase_06 AC 2,286 ms
133,584 KB
testcase_07 AC 2,320 ms
129,088 KB
testcase_08 AC 2,431 ms
133,728 KB
testcase_09 AC 943 ms
64,440 KB
testcase_10 AC 1,381 ms
87,784 KB
testcase_11 AC 1,266 ms
86,720 KB
testcase_12 AC 1,541 ms
87,596 KB
testcase_13 AC 1,339 ms
87,560 KB
testcase_14 AC 2,430 ms
133,800 KB
testcase_15 AC 2,434 ms
133,352 KB
testcase_16 AC 2,454 ms
133,828 KB
testcase_17 AC 2,410 ms
133,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

for i in range(M):
    B[i]=100-B[i]

A.sort()
B.sort()

while len(B)<N:
    B.append(100)

B=B[:N]

import numpy
k=1
while k<N:
    k=k*2

k=k*2
#while len(B)<k:
#    B.append(100)

while len(A)<k:
    A.append(0)
    B.append(0)

g=numpy.fft.fft(A,k)
h=numpy.fft.fft(B,k)

f=[g[i]*h[i] for i in range(k)]

ANS=numpy.fft.ifft(f)

for ans in ANS[:N]:
    print(int(numpy.round(numpy.real(ans/100))))
0