結果

問題 No.2549 Paint Eggs
ユーザー hato336hato336
提出日時 2023-11-25 13:13:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 181,376 KB
最終ジャッジ日時 2023-11-25 13:14:00
合計ジャッジ時間 20,162 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
88,888 KB
testcase_01 AC 171 ms
89,272 KB
testcase_02 AC 141 ms
89,016 KB
testcase_03 AC 143 ms
88,888 KB
testcase_04 AC 147 ms
89,272 KB
testcase_05 AC 140 ms
88,120 KB
testcase_06 AC 148 ms
89,272 KB
testcase_07 AC 149 ms
89,272 KB
testcase_08 AC 140 ms
88,120 KB
testcase_09 AC 150 ms
88,760 KB
testcase_10 AC 491 ms
168,980 KB
testcase_11 AC 320 ms
136,576 KB
testcase_12 AC 420 ms
133,944 KB
testcase_13 AC 458 ms
158,404 KB
testcase_14 AC 267 ms
120,888 KB
testcase_15 AC 166 ms
89,656 KB
testcase_16 AC 482 ms
159,192 KB
testcase_17 AC 347 ms
123,988 KB
testcase_18 AC 332 ms
123,400 KB
testcase_19 AC 394 ms
129,336 KB
testcase_20 AC 494 ms
173,564 KB
testcase_21 AC 499 ms
173,448 KB
testcase_22 AC 498 ms
173,692 KB
testcase_23 AC 478 ms
174,980 KB
testcase_24 AC 489 ms
170,756 KB
testcase_25 AC 513 ms
181,376 KB
testcase_26 AC 522 ms
174,356 KB
testcase_27 AC 507 ms
171,776 KB
testcase_28 AC 501 ms
173,708 KB
testcase_29 AC 525 ms
174,352 KB
testcase_30 AC 465 ms
173,316 KB
testcase_31 AC 530 ms
170,884 KB
testcase_32 AC 493 ms
168,832 KB
testcase_33 AC 530 ms
170,244 KB
testcase_34 AC 537 ms
172,684 KB
testcase_35 AC 483 ms
172,420 KB
testcase_36 AC 510 ms
171,524 KB
testcase_37 AC 491 ms
174,084 KB
testcase_38 AC 501 ms
167,820 KB
testcase_39 AC 524 ms
170,624 KB
testcase_40 AC 462 ms
173,308 KB
testcase_41 AC 494 ms
173,324 KB
testcase_42 AC 465 ms
173,192 KB
testcase_43 AC 474 ms
173,192 KB
testcase_44 AC 502 ms
173,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#n = int(input())
#
#alist = []
#s = input()
n,m,k = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
color = list(map(lambda x:int(x)-1,input().split()))
alist = list(map(int,input().split()))
ans = min(alist) * k

c = collections.defaultdict(int)
ss = [set() for i in range(k+1)]
for i in range(k):
    c[color[i]] += 1
    ss[c[color[i]]].add(color[i])
for i in range(k,n):
    c[color[i-k]] -= 1
    c[color[i]] += 1
    ss[c[color[i]]].add(color[i])
for i in range(k+1):
    if ss[i]:
        s = list(ss[i])
        s.sort(key=lambda x:alist[x])
        ans = min(ans,alist[s[0]] * (k-i))
print(ans)
0