結果

問題 No.618 labo-index
ユーザー RyutoRyuto
提出日時 2017-12-18 21:37:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,051 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 97,748 KB
最終ジャッジ日時 2024-05-09 11:55:23
合計ジャッジ時間 33,742 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
54,092 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 WA -
testcase_03 AC 42 ms
51,328 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 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

Q = int(input())
events = []
for i in range(Q):
    events.append([int(x) for x in input().split()])

i = 1
ans = 0
labo_indexs = {}
for event in events:
    if event[0] == 1:
        labo_indexs[i] = event[1]
        i += 1
        if event[1] <= ans:
            print(ans)
            continue
    elif event[0] == 2:
        tmp = labo_indexs[event[1]]
        del labo_indexs[event[1]]
        if tmp < ans:
            print(ans)
            continue
    elif event[0] == 3:
        labo_indexs = dict([(x, y+event[1]) for (x, y) in labo_indexs.items()])
        if ans != 0 and event[1] >= 0:
            ans += event[1]
            print(ans)
            continue

    vals = sorted(labo_indexs.values(), reverse=True)
    for l in range(len(vals), -1, -1):
        npeop = 0
        for val in vals:
            if val >= l:
                npeop += 1
            elif val < l:
                break
        if npeop >= l:
            ans = l
            print(ans)
            break
        else:
            continue
0