結果
問題 | No.1831 Parasol |
ユーザー |
![]() |
提出日時 | 2022-02-04 23:24:24 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 864 bytes |
コンパイル時間 | 122 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 25,216 KB |
最終ジャッジ日時 | 2024-06-11 12:52:36 |
合計ジャッジ時間 | 5,127 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 12 RE * 6 |
ソースコード
N = int(input()) print(2*N-1) p = [[str(2*N-1)] for i in range (0, 2*N-1)] if N == 1: print(1) exit() if N == 2: print('3 2') print('3 2') print('3 1') exit() import collections as col d = col.deque() for i in range (0, 2*N-2): q = 2*N-2-i for j in range (0, q): d.append(str(q)) for i in range (0, (N-2)*(2*N-1)): p[i%(2*N-1)].append(d.popleft()) ikkai = set() mate = set() for i in range (0, 2*N-1): c = 0 s= "".join(p[i]) while c == 0: q = d.popleft() if s+q in mate: d.append(s+q) else: if s+q in ikkai: mate.add(s+q) else: ikkai.add(s+q) c = 1 p[i].append(q) for i in range (0, len(p)): v = [] for j in range (0, len(p[i])): v.append(int(p[i][j])) print(*v)