結果
問題 | No.1831 Parasol |
ユーザー |
![]() |
提出日時 | 2022-02-04 22:31:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 209 ms / 2,000 ms |
コード長 | 584 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-11 12:07:11 |
合計ジャッジ時間 | 3,208 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
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)