結果

問題 No.1831 Parasol
ユーザー tnodinotnodino
提出日時 2022-02-04 22:31:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 584 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 8,468 KB
最終ジャッジ日時 2023-09-02 05:07:44
合計ジャッジ時間 3,386 ms
ジャッジサーバーID
(参考情報)
judge14 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
7,828 KB
testcase_01 AC 183 ms
8,352 KB
testcase_02 AC 16 ms
7,832 KB
testcase_03 AC 16 ms
7,816 KB
testcase_04 AC 189 ms
8,384 KB
testcase_05 AC 16 ms
7,832 KB
testcase_06 AC 17 ms
7,780 KB
testcase_07 AC 181 ms
8,404 KB
testcase_08 AC 16 ms
7,896 KB
testcase_09 AC 16 ms
7,772 KB
testcase_10 AC 128 ms
8,312 KB
testcase_11 AC 180 ms
8,344 KB
testcase_12 AC 80 ms
8,468 KB
testcase_13 AC 168 ms
8,392 KB
testcase_14 AC 27 ms
8,412 KB
testcase_15 AC 45 ms
8,336 KB
testcase_16 AC 17 ms
7,836 KB
testcase_17 AC 17 ms
7,832 KB
testcase_18 AC 38 ms
8,328 KB
testcase_19 AC 16 ms
7,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
M = 2 * N - 1
L = [i for i in range(1,M+1)]
print(M)
K = [i for i in range(M,M-N,-1)]
cnt = 0
for c in range(M):
    print(*K)
    if c == M - 1:
        break
    for i in range(N):
        L[K[i]-1] -= 1
    P = list(K)
    for i in range(N):
        while L[P[i]-1] == 0:
            P[i] -= 1
        if i < N - 1 and P[i+1] == P[i]:
            P[i+1] = P[i] - 1
    if K == P:
        cnt += 1
        if cnt == 2:
            P[-1] -= 1
            while L[P[-1]-1] == 0:
                P[-1] -= 1
            cnt = 0
    else:
        cnt = 0
    K = list(P)
0