結果

問題 No.714 回転寿司屋のシミュレート
ユーザー daku9640daku9640
提出日時 2018-07-14 00:39:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,094 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-17 11:47:26
合計ジャッジ時間 2,376 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 31 ms
10,880 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 AC 34 ms
10,880 KB
testcase_05 AC 36 ms
10,880 KB
testcase_06 AC 41 ms
11,008 KB
testcase_07 AC 50 ms
10,880 KB
testcase_08 AC 62 ms
10,880 KB
testcase_09 AC 45 ms
10,880 KB
testcase_10 AC 39 ms
10,880 KB
testcase_11 AC 41 ms
10,880 KB
testcase_12 AC 39 ms
11,008 KB
testcase_13 AC 39 ms
10,880 KB
testcase_14 AC 39 ms
11,008 KB
testcase_15 AC 39 ms
10,880 KB
testcase_16 AC 37 ms
10,880 KB
testcase_17 AC 39 ms
11,008 KB
testcase_18 AC 39 ms
10,880 KB
testcase_19 AC 37 ms
10,880 KB
testcase_20 AC 39 ms
11,008 KB
testcase_21 AC 39 ms
11,008 KB
testcase_22 AC 36 ms
10,880 KB
testcase_23 AC 37 ms
10,880 KB
testcase_24 AC 37 ms
10,880 KB
testcase_25 AC 35 ms
10,880 KB
testcase_26 AC 34 ms
10,880 KB
testcase_27 AC 36 ms
10,752 KB
testcase_28 AC 35 ms
10,880 KB
testcase_29 AC 33 ms
11,008 KB
testcase_30 AC 28 ms
10,752 KB
testcase_31 AC 29 ms
10,880 KB
testcase_32 AC 29 ms
11,008 KB
testcase_33 AC 29 ms
11,008 KB
testcase_34 AC 27 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n = int(input())
li = [[0] * 22 for _ in range(100)]
sushi = {}
scnt = 0
kyaku = defaultdict(set)
for i in range(n):
    u = input().split()
    if u[0] == "0":
        m = defaultdict(int)
        a, b = map(int, u[1:3])
        for s in u[3:]:
            if s not in sushi:
                sushi[s] = scnt
                scnt += 1
            m[s] += 1
        for k, v in m.items():
            li[sushi[k]][a] = v
            li[sushi[k]][21] += v
            kyaku[a].add(k)
    elif u[0] == "1":
        s = u[1]
        if s in sushi and li[sushi[s]][21]:
            for j in range(1, 21):
                if li[sushi[s]][j]:
                    print(j)
                    li[sushi[s]][j] -= 1
                    if li[sushi[s]][j] == 0:
                        kyaku[j].remove(s)
                    li[sushi[s]][21] -= 1
                    break
        else:
            print(-1)
    else:
        a = int(u[1])
        for b in kyaku[a]:
            li[sushi[b]][21] -= li[sushi[b]][a]
            li[sushi[b]][a] = 0
        del kyaku[a]
0