結果

問題 No.893 お客様を誘導せよ
ユーザー はむ吉🐹はむ吉🐹
提出日時 2019-09-27 21:55:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 11,784 KB
実行使用メモリ 17,112 KB
最終ジャッジ日時 2023-10-24 17:53:39
合計ジャッジ時間 1,491 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,076 KB
testcase_01 AC 27 ms
10,076 KB
testcase_02 AC 37 ms
10,980 KB
testcase_03 AC 68 ms
13,676 KB
testcase_04 AC 67 ms
13,404 KB
testcase_05 AC 63 ms
13,120 KB
testcase_06 AC 53 ms
12,320 KB
testcase_07 AC 27 ms
10,076 KB
testcase_08 AC 108 ms
17,112 KB
testcase_09 AC 31 ms
10,964 KB
testcase_10 AC 27 ms
10,080 KB
testcase_11 AC 34 ms
10,916 KB
testcase_12 AC 35 ms
10,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections


def solve(num_rows, customer_rows):
    customer_queues = [collections.deque(row) for row in customer_rows]
    res_row = []
    while any(customer_queues):
        for i in range(num_rows):
            if customer_queues[i]:
                res_row.append(customer_queues[i].popleft())
    return res_row


def main():
    n = int(input())
    customer_rows = []
    for _ in range(n):
        args = [int(z) for z in input().split()]
        row = args[1:]
        customer_rows.append(row)
    res = solve(n, customer_rows)
    print(*res)


if __name__ == "__main__":
    main()
0