用户输出
1
5
4
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#3767 | #1011. 小田的存钱罐 | Wrong Answer | 45 | 14172 ms | 6324 K | Python 3 / 1.4 K | s230034010 | 2023-11-25 16:48:33 |
class MoneyJar:
def __init__(self):
self.money = {} # 用字典来存储面值和对应数量
# 操作1:将一张面值为x的钞票加入存钱罐中
def add_money(self, x):
if x in self.money:
self.money[x] += 1
else:
self.money[x] = 1
# 操作2:从存钱罐中取出c张面值为x的钞票
def remove_money(self, x, c):
if x in self.money:
if self.money[x] >= c:
self.money[x] -= c
else:
del self.money[x] # 面值为x的钞票不足c张,全部取出
# 操作3:返回存钱罐中面值最大的钞票减去面值最小的钞票的值
def calculate_difference(self):
if not self.money:
return 0
min_value = min(self.money.keys())
max_value = max(self.money.keys())
return max_value - min_value
q = int(input())
money_jar = MoneyJar()
results = []
for _ in range(q):
query = input().split()
o = int(query[0])
if o == 1:
x = int(query[1])
money_jar.add_money(x)
elif o == 2:
x = int(query[1])
c = int(query[2])
money_jar.remove_money(x, c)
elif o == 3:
diff = money_jar.calculate_difference()
results.append(diff)
for result in results:
print(result)
# 再超时就不写了,垃圾ACM
用户输出
1
5
4
系统信息
Exited with return code 0
200000
1 158260522
1 158260522
1 158260522
1 158260522
1 158260522
3
2 158260522 3
1 158260522
3
3
2
<1822667 bytes omitted>
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
<133130 bytes omitted>
用户输出
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
<133102 bytes omitted>
系统信息
Exited with return code 0
200000
1 404926844
3
3
1 943492766
3
1 404926844
3
1 404926844
1 943492766
2 404926844 2
2 404926844
<1711818 bytes omitted>
0
0
538565922
538565922
0
0
0
0
0
0
0
0
538565922
538565922
0
0
0
0
0
538565922
538565922
538565922
<522556 bytes omitted>
用户输出
0
0
538565922
538565922
538565922
538565922
538565922
538565922
538565922
538565922
538565922
538565922
538565922
538565922
5385
<770056 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
200000
1 504709350
3
1 504709350
3
1 669577130
1 565454584
2 669577130 1
2 504709350 1
2 504709350 1
<1687449 bytes omitted>
0
0
60745234
60745234
60745234
60745234
164867780
164867780
164867780
104122546
164867780
164867780
<690750 bytes omitted>
用户输出
0
0
164867780
164867780
164867780
164867780
164867780
164867780
164867780
164867780
164867780
164867780
164867780
164867780
1648
<792666 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
200000
1 101102
3
1 101102
1 806736280
3
3
2 101102 1
3
1 256060446
3
3
1 806736280
1 372964315
2 25
<1644095 bytes omitted>
0
806635178
806635178
806635178
806635178
806635178
806635178
806635178
806635178
728074795
80663517
<800164 bytes omitted>
用户输出
0
806635178
806635178
806635178
806635178
806635178
806635178
806635178
806635178
806635178
806635178
806635178
806635178
806635
<800154 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
200000
1 879601392
1 2208309
1 2208309
1 693906524
2 879601392 1
1 693906524
3
1 855648094
1 5626880
<1655382 bytes omitted>
691698215
853439785
853439785
853439785
853439785
853439785
978284941
978284941
978284941
978284941
<800459 bytes omitted>
用户输出
877393083
877393083
877393083
877393083
877393083
877393083
978284941
978284941
978284941
978284941
978284941
978284941
97828494
<800462 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
200000
1 247639032
1 777329308
3
1 498286185
1 498286185
2 247639032 1
3
3
1 674916137
3
1 916525278
<1680170 bytes omitted>
529690276
279043123
279043123
279043123
668886246
668886246
668886246
668886246
765842382
765842382
<799363 bytes omitted>
用户输出
529690276
529690276
529690276
529690276
668886246
668886246
668886246
668886246
765842382
765842382
765842382
765842382
76584238
<799382 bytes omitted>
Special Judge 信息
Files user_out and answer differ
系统信息
Exited with return code 0
200000
1 655487992
3
3
3
3
3
3
1 611660901
3
3
1 974018054
3
3
3
1 911221319
3
1 762558266
3
3
1 744
<1663388 bytes omitted>
200000
1 826143456
3
1 628797840
1 983206966
1 791914334
3
3
1 440668866
3
3
1 214044032
3
3
3
3
3
3
<1666495 bytes omitted>
200000
1 848837086
3
1 178452624
1 916086662
3
3
3
3
1 96479006
3
3
1 411156951
1 531760231
1 211336
<1450452 bytes omitted>
200000
2 293519400 200000
2 914159648 200000
2 115759974 200000
1 980862633
2 897088345 200000
2 976
<2877507 bytes omitted>
200000
2 197108808 200000
2 938365703 200000
2 421962281 200000
1 69997378
2 981625223 200000
1 8616
<2877806 bytes omitted>
200000
2 241309635 200000
2 687899457 200000
1 950087837
1 236920052
3
1 550166398
1 521326769
1 248
<2883102 bytes omitted>
200000
1 249046243
1 249046243
1 249046243
1 249046243
1 249046243
1 249046243
1 249046243
1 2490462
<2559893 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
200000
1 341006745
1 341006745
1 341006745
1 341006745
1 341006745
1 341006745
1 341006745
1 3410067
<2539893 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
200000
1 927123882
1 927123882
1 927123882
1 927123882
1 927123882
1 927123882
1 927123882
1 9271238
<2519893 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
200000
1 865468011
1 865468011
1 865468011
1 865468011
1 865468011
1 865468011
1 865468011
1 8654680
<2499893 bytes omitted>
用户输出
0
系统信息
Exited with return code 0
200000
1 466019537
1 466019537
1 466019537
1 466019537
1 466019537
1 466019537
1 466019537
1 4660195
<2479893 bytes omitted>
用户输出
0
系统信息
Exited with return code 0