結果

問題 No.2770 Coupon Optimization
ユーザー detteiuudetteiuu
提出日時 2024-05-31 22:27:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 520 ms / 3,000 ms
コード長 507 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 138,148 KB
最終ジャッジ日時 2024-05-31 22:27:57
合計ジャッジ時間 7,982 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,260 KB
testcase_01 AC 38 ms
52,900 KB
testcase_02 AC 38 ms
52,936 KB
testcase_03 AC 200 ms
102,160 KB
testcase_04 AC 227 ms
132,952 KB
testcase_05 AC 81 ms
101,812 KB
testcase_06 AC 428 ms
112,872 KB
testcase_07 AC 216 ms
110,852 KB
testcase_08 AC 485 ms
138,144 KB
testcase_09 AC 142 ms
100,812 KB
testcase_10 AC 277 ms
100,400 KB
testcase_11 AC 243 ms
88,176 KB
testcase_12 AC 276 ms
108,316 KB
testcase_13 AC 244 ms
104,560 KB
testcase_14 AC 508 ms
138,148 KB
testcase_15 AC 491 ms
138,028 KB
testcase_16 AC 520 ms
137,884 KB
testcase_17 AC 489 ms
137,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(B)

idx = [-1]*100
pre = dict()
for i in range(1, M):
    if B[i] != B[i-1]:
        idx[B[i]] = i
        pre[B[i]] = B[i-1]

ans = 0
for i in range(N):
    ans += A[i]//100*(100-B[0])
    if i >= M:
        ans += A[i-M]//100*B[-1]
    for j in range(100):
        if idx[j] != -1 and idx[j] <= i:
            ans += A[i-idx[j]]//100*(pre[j]-j)
    print(ans)
0