結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
13,312 KB
testcase_01 AC 36 ms
13,184 KB
testcase_02 AC 36 ms
13,184 KB
testcase_03 AC 37 ms
13,440 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 45 ms
13,440 KB
testcase_20 AC 42 ms
13,440 KB
testcase_21 AC 43 ms
13,312 KB
testcase_22 AC 42 ms
13,440 KB
testcase_23 AC 42 ms
13,440 KB
testcase_24 AC 43 ms
13,440 KB
testcase_25 AC 45 ms
13,184 KB
testcase_26 AC 43 ms
13,184 KB
testcase_27 AC 42 ms
13,312 KB
testcase_28 AC 40 ms
13,312 KB
testcase_29 AC 41 ms
13,056 KB
testcase_30 AC 36 ms
13,312 KB
testcase_31 WA -
testcase_32 AC 36 ms
13,312 KB
testcase_33 AC 34 ms
13,184 KB
testcase_34 AC 35 ms
13,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n = int(input())
li = [[0] * 21 for _ in range(10000)]
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]][20] += v
            kyaku[a].add(k)
    elif u[0] == "1":
        s = u[1]
        if s in sushi and li[sushi[s]][20]:
            for j in range(20):
                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]][20] -= 1
                    break
        else:
            print(-1)
    else:
        a = int(u[1])
        for b in kyaku[a]:
            li[sushi[b]][20] -= li[sushi[b]][a]
            li[sushi[b]][a] = 0
        del kyaku[a]
0