結果

問題 No.618 labo-index
ユーザー Bioinfo_K
提出日時 2017-12-19 21:25:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 23,168 KB
最終ジャッジ日時 2024-12-16 02:05:17
合計ジャッジ時間 137,550 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 16 TLE * 15 OLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,collections,heapq,copy
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())

q = I()
h = []
d,power = 0,0
for i in range(q):
    t,x = Is()
    if   t == 1:
        h.append(x+power)
    elif t == 2:
        print(h[x-1], "deleted")
        h[x-1] = -10**15
        d += 1
    else:
        power += x
    l = copy.deepcopy(h)
    l.sort(reverse=True)
    l = l[:len(l)-d]
    print(l,power)
    ans = 0
    for i,e in enumerate(l):
        e = 0 if e+power<=0 else e+power
        if i+1 <=e:
            ans = min(i+1,e)
        else:
            break
    print(ans)
        
0