結果

問題 No.1619 Coccinellidae
ユーザー shotoyooshotoyoo
提出日時 2021-07-22 23:11:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 832 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 80,332 KB
最終ジャッジ日時 2023-09-24 19:11:44
合計ジャッジ時間 3,469 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,304 KB
testcase_01 AC 86 ms
79,184 KB
testcase_02 AC 89 ms
80,332 KB
testcase_03 AC 74 ms
71,524 KB
testcase_04 AC 87 ms
80,248 KB
testcase_05 AC 85 ms
78,464 KB
testcase_06 AC 71 ms
71,124 KB
testcase_07 AC 82 ms
78,472 KB
testcase_08 AC 85 ms
78,584 KB
testcase_09 AC 72 ms
71,264 KB
testcase_10 AC 83 ms
78,216 KB
testcase_11 AC 85 ms
78,876 KB
testcase_12 AC 71 ms
71,256 KB
testcase_13 AC 85 ms
80,112 KB
testcase_14 AC 90 ms
80,268 KB
testcase_15 AC 71 ms
71,304 KB
testcase_16 AC 72 ms
71,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n,m,k = list(map(int, input().split()))
def sub(n,m,k):
    k0 = k
    l = list(range(n))
    l[-1] = m - (n-1)*(n-2)//2
    l.sort()
#     print(l)
    ans = [-1]*n
    done = [0]*n
    for v in range(n, 0, -1):
        i = n - v
        if k>v-1:
            k -= v-1
            ans[v-1] = l[i]
            done[i] = 1
        else:
            ans[k] = l[i]
            done[i] = 1
            break
    j = 0
    for i in range(n):
        while j<n and ans[j]>=0:
            j += 1
        if not done[i]:
            ans[j] = l[i]
#     print(ans, k)
    write("\n".join(map(str, ans)))
sub(n,m,k)
0