結果

問題 No.478 一般門松列列
ユーザー lloyzlloyz
提出日時 2023-08-09 07:06:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 69,952 KB
最終ジャッジ日時 2024-04-26 21:51:14
合計ジャッジ時間 4,477 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,376 KB
testcase_01 AC 37 ms
52,344 KB
testcase_02 AC 37 ms
52,560 KB
testcase_03 AC 39 ms
52,684 KB
testcase_04 AC 38 ms
52,032 KB
testcase_05 AC 38 ms
52,808 KB
testcase_06 AC 39 ms
52,436 KB
testcase_07 AC 38 ms
53,448 KB
testcase_08 AC 37 ms
52,712 KB
testcase_09 WA -
testcase_10 AC 38 ms
51,956 KB
testcase_11 AC 56 ms
69,324 KB
testcase_12 AC 52 ms
66,284 KB
testcase_13 AC 55 ms
69,044 KB
testcase_14 AC 57 ms
69,456 KB
testcase_15 AC 55 ms
69,304 KB
testcase_16 AC 53 ms
66,072 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 56 ms
69,952 KB
testcase_20 WA -
testcase_21 AC 54 ms
67,204 KB
testcase_22 AC 56 ms
67,284 KB
testcase_23 AC 55 ms
67,060 KB
testcase_24 AC 49 ms
64,784 KB
testcase_25 AC 55 ms
68,744 KB
testcase_26 AC 48 ms
62,304 KB
testcase_27 AC 53 ms
65,116 KB
testcase_28 WA -
testcase_29 AC 48 ms
62,220 KB
testcase_30 AC 54 ms
66,620 KB
testcase_31 AC 54 ms
65,756 KB
testcase_32 AC 48 ms
62,304 KB
testcase_33 AC 54 ms
65,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())

ANS = [0 for _ in range(n)]
num = n - k - 2
res = 0
for i in range(1, n - 1):
    if res == num:
        break
    if ANS[i - 1] == ANS[i] == ANS[i + 1]:
        ANS[i] = 2
        ANS[i + 1] = 1
    elif ANS[i - 1] > ANS[i]:
        ANS[i + 1] = ANS[i - 1] + 1
    elif ANS[i - 1] < ANS[i]:
        ANS[i + 1] = ANS[i - 1] - 1
        if ANS[i + 1] == -1:
            ANS[i + 1] = 1
    res += 1
print(*ANS)
0