結果

問題 No.1770 N言っちゃダメゲーム (6)
ユーザー KudeKude
提出日時 2021-12-02 07:05:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 86,572 KB
実行使用メモリ 91,896 KB
最終ジャッジ日時 2023-09-18 10:09:33
合計ジャッジ時間 7,093 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,376 KB
testcase_01 AC 97 ms
71,128 KB
testcase_02 AC 90 ms
70,928 KB
testcase_03 AC 91 ms
70,700 KB
testcase_04 AC 91 ms
71,432 KB
testcase_05 AC 91 ms
71,144 KB
testcase_06 AC 104 ms
78,568 KB
testcase_07 AC 103 ms
78,208 KB
testcase_08 AC 90 ms
71,172 KB
testcase_09 AC 92 ms
71,260 KB
testcase_10 AC 113 ms
79,048 KB
testcase_11 AC 114 ms
78,520 KB
testcase_12 AC 112 ms
79,048 KB
testcase_13 AC 92 ms
70,704 KB
testcase_14 AC 92 ms
71,232 KB
testcase_15 AC 92 ms
70,840 KB
testcase_16 AC 91 ms
71,164 KB
testcase_17 AC 108 ms
77,240 KB
testcase_18 AC 91 ms
71,440 KB
testcase_19 AC 92 ms
71,252 KB
testcase_20 AC 92 ms
71,432 KB
testcase_21 AC 90 ms
70,880 KB
testcase_22 AC 90 ms
71,472 KB
testcase_23 AC 101 ms
76,764 KB
testcase_24 AC 101 ms
76,504 KB
testcase_25 AC 104 ms
77,140 KB
testcase_26 AC 104 ms
76,904 KB
testcase_27 AC 102 ms
77,372 KB
testcase_28 AC 116 ms
78,592 KB
testcase_29 AC 110 ms
77,496 KB
testcase_30 AC 116 ms
78,120 KB
testcase_31 AC 111 ms
77,948 KB
testcase_32 AC 132 ms
89,856 KB
testcase_33 AC 133 ms
91,044 KB
testcase_34 AC 134 ms
89,740 KB
testcase_35 AC 137 ms
90,944 KB
testcase_36 AC 136 ms
91,164 KB
testcase_37 AC 134 ms
90,828 KB
testcase_38 AC 119 ms
78,524 KB
testcase_39 AC 113 ms
78,464 KB
testcase_40 AC 113 ms
78,868 KB
testcase_41 AC 114 ms
78,920 KB
testcase_42 AC 109 ms
78,912 KB
testcase_43 AC 134 ms
90,800 KB
testcase_44 AC 106 ms
77,624 KB
testcase_45 AC 133 ms
90,384 KB
testcase_46 AC 132 ms
91,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n, k = map(int, input().split())
wins = deque()
win_others = [[] for  _ in range(n)]
for i in range(n - 1, 0, -1):
    cnt = len(wins) + len(win_others[i])
    if cnt == 0:
        wins.appendleft(i)
    elif cnt == 1:
        j = wins[0] if wins else win_others[i][0]
        p = i - (j - i)
        if p >= 0:
            win_others[p].append(i)
    if wins and wins[-1] == i + k:
        wins.pop()
ans = sorted(win_others[0] + list(wins))
if ans:
    print(*ans, sep='\n')
else:
    print(0)
0