結果
| 問題 | No.1619 Coccinellidae |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-06-08 00:32:05 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 958 bytes |
| 記録 | |
| コンパイル時間 | 506 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 86,272 KB |
| 最終ジャッジ日時 | 2026-06-08 00:32:10 |
| 合計ジャッジ時間 | 3,103 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 16 |
ソースコード
## https://yukicoder.me/problems/no/1619
import math
def main():
N, M, K = map(int, input().split())
array = [-1] * N
for n in reversed(range(1, N)):
if K >= n:
array[N - 1 - n] = n
K -= n
else:
array[N - 1 - K] = n
K = 0
if K == 0:
index = 0
for i in range(n):
while index < N and array[index] != -1:
index += 1
if index < N:
array[index] = i
break
a_array = [(i, array[i]) for i in range(N)]
a_array.sort(key=lambda x : x[1])
m = 0
answer = [-1] * N
tot_m = 0
for index in range(N):
if index == N - 1:
m = M - tot_m
i, _ = a_array[index]
answer[i] = m
tot_m += m
m += 1
for a in answer:
print(a)
if __name__ == "__main__":
main()