Submission #19467894


Source Code Expand

Copy
import collections

N, K = map(int, input().split())

dic = collections.defaultdict(int)
A = list(map(int, input().split()))
mx = 0
for a in A:
    dic[a] += 1
    mx = max(mx, a)

ans = 0
tmp_k = K
for i in range(mx + 2):
    if tmp_k <= dic[i]:
        continue
    ans += (tmp_k - dic[i]) * i
    tmp_k = dic[i]
print(ans)

Submission Info

Submission Time
Task B - Mex Boxes
User oniku
Language Python (3.8.2)
Score 400
Code Size 345 Byte
Status AC
Exec Time 318 ms
Memory 46008 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 55
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, random_35.txt, random_36.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
hand_01.txt AC 143 ms 14684 KB
hand_02.txt AC 144 ms 14468 KB
hand_03.txt AC 141 ms 14536 KB
hand_04.txt AC 147 ms 14372 KB
hand_05.txt AC 170 ms 35132 KB
hand_06.txt AC 169 ms 36564 KB
hand_07.txt AC 168 ms 35344 KB
hand_08.txt AC 242 ms 36016 KB
hand_09.txt AC 212 ms 45452 KB
hand_10.txt AC 213 ms 45928 KB
hand_11.txt AC 223 ms 46008 KB
hand_12.txt AC 215 ms 45884 KB
hand_13.txt AC 318 ms 42368 KB
hand_14.txt AC 267 ms 44356 KB
hand_15.txt AC 308 ms 43816 KB
hand_16.txt AC 265 ms 43320 KB
random_01.txt AC 134 ms 23944 KB
random_02.txt AC 122 ms 22944 KB
random_03.txt AC 218 ms 36484 KB
random_04.txt AC 184 ms 29580 KB
random_05.txt AC 137 ms 24440 KB
random_06.txt AC 133 ms 23160 KB
random_07.txt AC 203 ms 35988 KB
random_08.txt AC 180 ms 28488 KB
random_09.txt AC 118 ms 22488 KB
random_10.txt AC 123 ms 23876 KB
random_11.txt AC 192 ms 29252 KB
random_12.txt AC 136 ms 24648 KB
random_13.txt AC 116 ms 23192 KB
random_14.txt AC 209 ms 36408 KB
random_15.txt AC 188 ms 35692 KB
random_16.txt AC 129 ms 24336 KB
random_17.txt AC 183 ms 36080 KB
random_18.txt AC 195 ms 36112 KB
random_19.txt AC 124 ms 23424 KB
random_20.txt AC 120 ms 23824 KB
random_21.txt AC 165 ms 27484 KB
random_22.txt AC 157 ms 25988 KB
random_23.txt AC 124 ms 23108 KB
random_24.txt AC 209 ms 35080 KB
random_25.txt AC 114 ms 26764 KB
random_26.txt AC 93 ms 22216 KB
random_27.txt AC 87 ms 21216 KB
random_28.txt AC 193 ms 36136 KB
random_29.txt AC 97 ms 23196 KB
random_30.txt AC 86 ms 20800 KB
random_31.txt AC 81 ms 19788 KB
random_32.txt AC 201 ms 36088 KB
random_33.txt AC 116 ms 27040 KB
random_34.txt AC 98 ms 24524 KB
random_35.txt AC 88 ms 20796 KB
random_36.txt AC 186 ms 29328 KB
sample_01.txt AC 23 ms 9148 KB
sample_02.txt AC 21 ms 9448 KB
sample_03.txt AC 29 ms 9268 KB