結果

問題 No.1528 Not 1
コンテスト
ユーザー tktk_snsn
提出日時 2021-06-04 20:08:36
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 54 ms / 2,000 ms
+ 747µs
コード長 506 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 57 ms
コンパイル使用メモリ 15,232 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2026-09-26 14:20:39
合計ジャッジ時間 2,508 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    N = int(input())
    if N == 1:
        print(1)
        return

    if N % 2 == 0:
        print(*list(range(2, N+1, 2)))
        return

    ans = []
    for a in range(2, N+1, 2):
        v = a
        while v % 2 == 0:
            v //= 2
        if v != 1:
            ans.append(v)
            ans.append(a)
            for x in range(2, N+1, 2):
                if x != a:
                    ans.append(x)
            print(*ans)
            return
    print(-1)
    return


main()
0