結果

問題 No.1831 Parasol
ユーザー KuonAyanoKuonAyano
提出日時 2022-02-04 23:24:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 864 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 25,732 KB
最終ジャッジ日時 2023-09-02 05:56:26
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,328 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 19 ms
8,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0