結果
問題 |
No.2804 Fixer And Ratism
|
ユーザー |
|
提出日時 | 2024-07-12 21:41:44 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 949 bytes |
コンパイル時間 | 607 ms |
コンパイル使用メモリ | 82,340 KB |
実行使用メモリ | 97,684 KB |
最終ジャッジ日時 | 2024-07-16 03:11:55 |
合計ジャッジ時間 | 24,813 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 TLE * 1 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline #n = int(input()) # #alist = [] input = sys.stdin.readline n,q = map(int,input().split()) h = [] c = collections.defaultdict(int) for i in range(q): t = input().split() if t[0] == '1': t,s,r = t r = int(r) heapq.heappush(h,(r,s)) c[s] = r if t[0] == '2': t,x = t x = int(x) n -= x if t[0] == '3': t,s,x = t x = int(x) n += x h.remove((c[s],s)) h.append((c[s] | (1<<40),s)) c[s] |= 1<<40 heapq.heapify(h) a = [] while len(h) > n: ans = heapq.heappop(h) ans = list(ans) if (ans[0] >> 40) & 1 == 1: ans[0] -= 1<<40 a.append((ans[0],ans[1])) a.sort() for k,l in a: print(l)