头像
外包不准吃公司零食
发布于 2020-02-22 22:20
+ 关注

python3

import sys
N = int(sys.stdin.readline())
D = {}
for _ in range(N):
    string = sys.stdin.readline().strip()
    if len(string.split()) == 2:
        t, c = map(int, string.split())
        flag = True
        for k in range(t-30, t+31):
            if k in D.keys():
                flag = False
                break
        if flag == False:
            continue
        else:
            if t in D.keys():
                D[t] += c 
            else:
                D[t] = c
    elif int(string) == -1:
        if not D:
            print('skipped')
        else:
            print(D[min(D.keys())])
            D.pop(min(D.keys()))
    else:
        t = int(string)
        if t in D.keys():
            print(D[t])
        else:
            print(0)

全部评论

(1) 回帖
加载中...
话题 回帖

等你来战

查看全部

热门推荐