結果

問題 No.1619 Coccinellidae
ユーザー shotoyooshotoyoo
提出日時 2021-07-22 22:41:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,071 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 80,524 KB
最終ジャッジ日時 2023-09-24 18:09:20
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 80 ms
71,308 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 80 ms
71,088 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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]
#     assert sum(ans)==m
#     assert all((ans[i]>=0 for i in range(n)))
#     val = 0
#     for i in range(n):
#         for j in range(i+1,n):
#             if ans[i]>ans[j]:
#                 val += 1
#     print(val, val)
#     assert val==k0
    write("\n".join(map(str, ans)))
sub(n,m,k)
0