Submission #10374146


Source Code Expand

Copy
from collections import Counter
from heapq import heapify, heappush, heappop

def solve():
    N = int(input())
    Ss = list(map(int, input().split()))

    cnt = Counter(Ss)

    PQ = [-N]
    for key in sorted(cnt.keys(), reverse=True):
        num = cnt[key]
        if len(PQ) < num:
            return False
        depths = []
        for _ in range(num):
            depths.append(-heappop(PQ))
        for depth in depths:
            for d in range(depth):
                heappush(PQ, -d)

    return True

if solve():
    print('Yes')
else:
    print('No')

Submission Info

Submission Time
Task F - Many Slimes
User ZollingerPython3
Language Python (3.4.3)
Score 600
Code Size 598 Byte
Status AC
Exec Time 680 ms
Memory 36420 KB

Judge Result

Set Name All Sample
Score / Max Score 600 / 600 0 / 0
Status
AC × 79
AC × 4
Set Name Test Cases
All sample_01, sample_02, sample_03, sample_04, testcase_0, testcase_1, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18, testcase_19, testcase_2, testcase_20, testcase_21, testcase_22, testcase_23, testcase_24, testcase_25, testcase_26, testcase_27, testcase_28, testcase_29, testcase_3, testcase_30, testcase_31, testcase_32, testcase_33, testcase_34, testcase_35, testcase_36, testcase_37, testcase_38, testcase_39, testcase_4, testcase_40, testcase_41, testcase_42, testcase_43, testcase_44, testcase_45, testcase_46, testcase_47, testcase_48, testcase_49, testcase_5, testcase_50, testcase_51, testcase_52, testcase_53, testcase_54, testcase_55, testcase_56, testcase_57, testcase_58, testcase_59, testcase_6, testcase_60, testcase_61, testcase_62, testcase_63, testcase_64, testcase_65, testcase_66, testcase_67, testcase_68, testcase_69, testcase_7, testcase_70, testcase_71, testcase_72, testcase_73, testcase_74, testcase_8, testcase_9
Sample sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 AC 20 ms 3316 KB
sample_02 AC 20 ms 3316 KB
sample_03 AC 20 ms 3316 KB
sample_04 AC 21 ms 3316 KB
testcase_0 AC 21 ms 3316 KB
testcase_1 AC 21 ms 3316 KB
testcase_10 AC 272 ms 32884 KB
testcase_11 AC 21 ms 3316 KB
testcase_12 AC 21 ms 3316 KB
testcase_13 AC 21 ms 3316 KB
testcase_14 AC 144 ms 17876 KB
testcase_15 AC 20 ms 3316 KB
testcase_16 AC 21 ms 3316 KB
testcase_17 AC 271 ms 34248 KB
testcase_18 AC 21 ms 3316 KB
testcase_19 AC 20 ms 3316 KB
testcase_2 AC 234 ms 18100 KB
testcase_20 AC 81 ms 10584 KB
testcase_21 AC 275 ms 32884 KB
testcase_22 AC 28 ms 4308 KB
testcase_23 AC 275 ms 34376 KB
testcase_24 AC 82 ms 10584 KB
testcase_25 AC 20 ms 3316 KB
testcase_26 AC 28 ms 4212 KB
testcase_27 AC 21 ms 3444 KB
testcase_28 AC 21 ms 3316 KB
testcase_29 AC 20 ms 3316 KB
testcase_3 AC 198 ms 17268 KB
testcase_30 AC 21 ms 3316 KB
testcase_31 AC 264 ms 36396 KB
testcase_32 AC 267 ms 36396 KB
testcase_33 AC 253 ms 36396 KB
testcase_34 AC 259 ms 36392 KB
testcase_35 AC 256 ms 36392 KB
testcase_36 AC 43 ms 7600 KB
testcase_37 AC 21 ms 3316 KB
testcase_38 AC 20 ms 3316 KB
testcase_39 AC 21 ms 3444 KB
testcase_4 AC 482 ms 33024 KB
testcase_40 AC 43 ms 7600 KB
testcase_41 AC 68 ms 11764 KB
testcase_42 AC 20 ms 3316 KB
testcase_43 AC 266 ms 36396 KB
testcase_44 AC 20 ms 3316 KB
testcase_45 AC 31 ms 5616 KB
testcase_46 AC 181 ms 34352 KB
testcase_47 AC 20 ms 3316 KB
testcase_48 AC 20 ms 3316 KB
testcase_49 AC 21 ms 3316 KB
testcase_5 AC 429 ms 33020 KB
testcase_50 AC 37 ms 6968 KB
testcase_51 AC 20 ms 3316 KB
testcase_52 AC 22 ms 3444 KB
testcase_53 AC 21 ms 3316 KB
testcase_54 AC 55 ms 5616 KB
testcase_55 AC 20 ms 3316 KB
testcase_56 AC 20 ms 3316 KB
testcase_57 AC 37 ms 4676 KB
testcase_58 AC 21 ms 3316 KB
testcase_59 AC 680 ms 36396 KB
testcase_6 AC 516 ms 36420 KB
testcase_60 AC 21 ms 3316 KB
testcase_61 AC 20 ms 3316 KB
testcase_62 AC 20 ms 3316 KB
testcase_63 AC 20 ms 3316 KB
testcase_64 AC 21 ms 3316 KB
testcase_65 AC 20 ms 3316 KB
testcase_66 AC 21 ms 3316 KB
testcase_67 AC 20 ms 3316 KB
testcase_68 AC 21 ms 3316 KB
testcase_69 AC 20 ms 3316 KB
testcase_7 AC 270 ms 34376 KB
testcase_70 AC 20 ms 3316 KB
testcase_71 AC 20 ms 3316 KB
testcase_72 AC 21 ms 3316 KB
testcase_73 AC 21 ms 3316 KB
testcase_74 AC 21 ms 3316 KB
testcase_8 AC 265 ms 32884 KB
testcase_9 AC 281 ms 34504 KB