結果

問題 No.893 お客様を誘導せよ
ユーザー futago0118futago0118
提出日時 2020-07-20 00:04:08
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 920 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 16,220 KB
最終ジャッジ日時 2023-08-22 18:29:19
合計ジャッジ時間 6,800 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,444 KB
testcase_01 AC 19 ms
8,444 KB
testcase_02 AC 97 ms
9,740 KB
testcase_03 AC 917 ms
12,276 KB
testcase_04 AC 890 ms
12,300 KB
testcase_05 AC 709 ms
12,128 KB
testcase_06 AC 367 ms
10,936 KB
testcase_07 AC 19 ms
8,484 KB
testcase_08 AC 920 ms
16,220 KB
testcase_09 AC 31 ms
9,368 KB
testcase_10 AC 19 ms
8,648 KB
testcase_11 AC 727 ms
9,340 KB
testcase_12 AC 755 ms
9,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n = int(input())
T = deque()

b = deque()
for i in range(n):
    m = input().split()
    a = deque()
    b.append(int(m[0]))
    if m[0] != 0:
        for j in range(1,int(m[0])+1):
            a.append(int(m[j]))
    else:
        a.append("0")
    
    T.append(a)

#print(T)
#print(sum(b))

k = 0
ans = []
while sum(b) != 0:
    if b[k%n] != 0:
        ans.append(T[k%n].popleft())
        b[k%n] -= 1
    k += 1

print(*ans)    
0