結果

問題 No.893 お客様を誘導せよ
ユーザー kohei2019
提出日時 2022-01-10 12:47:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 88,640 KB
最終ジャッジ日時 2024-11-14 10:46:16
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N = int(input())
ls = []
for i in range(N):
    a = list(map(int,input().split()))
    if len(a) == 1:
        ls.append(collections.deque())
    else:
        ls.append(collections.deque(a[1:]))
ans = []
while ls:
    ll = []
    for q in ls:
        if not q:
            continue
        ans.append(q.popleft())
        ll.append(q)
    ls = ll
print(*ans)
0