結果

問題 No.1831 Parasol
ユーザー ripityripity
提出日時 2022-11-26 00:45:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 77,368 KB
最終ジャッジ日時 2024-04-10 05:21:52
合計ジャッジ時間 4,173 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,364 KB
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 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 36 ms
52,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = 2*N-1
rem = [(i+1) for i in range(M)]

print(M)
if N == 2:
    print(3, 2)
    print(3, 2)
    print(3, 1)
elif N == 3:
    print(5, 4, 3)
    print(5, 4, 3)
    print(5, 4, 2)
    print(5, 4, 1)
    print(5, 3, 2)
else:
    for l1 in range(N, M):
        for r2 in reversed(range(0, l1+1)):
            if rem[l1] > 0 and rem[r2] > 0:
                r1 = M
                l2 = r2-(N-(M-l1))
                ans = []
                for x in range(l1, r1):
                    rem[x] -= 1
                    ans.append(x+1)
                for x in range(l2, r2):
                    rem[x] -= 1
                    ans.append(x+1)
                print(*ans)
0