結果
問題 | No.1831 Parasol |
ユーザー |
|
提出日時 | 2022-02-05 11:21:28 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 854 bytes |
コンパイル時間 | 381 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 86,900 KB |
最終ジャッジ日時 | 2024-06-11 13:24:45 |
合計ジャッジ時間 | 4,153 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | AC * 1 TLE * 1 -- * 17 |
ソースコード
N = int(input())cnt = [i for i in range(2*N)]ans = []def dfs(i,List):global cntglobal ansif i == N-1:flag2 = Trueflag1 = TrueS = []for s in List:if cnt[s] >= 2:passelif cnt[s] == 1:flag2 = Falseelse:flag2 = Falseflag1 = Falseif flag2:for s in List:cnt[s]-=2S.append(s)ans.append(S)ans.append(S)elif flag1:for s in List:cnt[s]-=1S.append(s)ans.append(S)else:for nx in range(List[i]-1,0,-1):dfs(i+1,List + [nx])for l in range(2*N-1,1,-1):dfs(0,[l])print(len(ans))for s in ans:print(*s)