結果

問題 No.625 ソンタクロース
ユーザー ああいいああいい
提出日時 2022-04-28 12:39:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 453 ms / 4,000 ms
コード長 754 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 77,588 KB
最終ジャッジ日時 2023-09-10 16:48:18
合計ジャッジ時間 4,332 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,156 KB
testcase_01 AC 76 ms
71,148 KB
testcase_02 AC 72 ms
71,088 KB
testcase_03 AC 72 ms
71,156 KB
testcase_04 AC 71 ms
71,208 KB
testcase_05 AC 72 ms
71,156 KB
testcase_06 AC 73 ms
71,212 KB
testcase_07 AC 72 ms
71,612 KB
testcase_08 AC 73 ms
71,140 KB
testcase_09 AC 73 ms
71,368 KB
testcase_10 AC 71 ms
71,232 KB
testcase_11 AC 74 ms
71,280 KB
testcase_12 AC 73 ms
71,204 KB
testcase_13 AC 73 ms
71,088 KB
testcase_14 AC 73 ms
71,188 KB
testcase_15 AC 122 ms
76,964 KB
testcase_16 AC 96 ms
76,632 KB
testcase_17 AC 239 ms
77,116 KB
testcase_18 AC 453 ms
77,588 KB
testcase_19 AC 144 ms
76,968 KB
testcase_20 AC 146 ms
77,060 KB
testcase_21 AC 119 ms
77,144 KB
testcase_22 AC 381 ms
77,452 KB
testcase_23 AC 108 ms
76,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dat = [M]
for i in range(2,N+1):
    l = [(dat[j],j) for j in range(i-1)]
    l.sort(reverse = True)
    t = 0
    for j in dat:
        if j == -1:
            t += 1
    k = i // 2
    if t >= k:
        dat = [0] * (i - 1) + [M]
        continue
    count = 0
    s = set()
    for j in range(i - 1 - k):
        count += l[j][0]
        s.add(l[j][1])
    if count < k - t:
        dat.append(-1)
        continue
    else:
        for j in range(i-1):
            if j in s:
                dat[j] = 0
            else:
                if dat[j] >= 0:
                    dat[j] += 1
                    count -= 1
                else:
                    dat[j] = 0
        dat.append(count)
print(*dat[::-1])
    
0