QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#49019 | #2281. BnPC | Tice | Compile Error | / | / | C++ | 1.6kb | 2022-09-19 05:15:04 | 2022-09-19 05:15:05 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-09-19 05:15:05]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-09-19 05:15:04]
- 提交
answer
def totalPoints(): # calculate total points
total = 0
if len(events) > 0:
for x in range(len(events)):
if attributes[events[i]["name"]] > events[i]["points"]:
total += attributes[events[i]["name"]]
return total
line = input().split(" ")
attrAmount = int(line[0])
points = int(line[1])
attributes = {}
for i in range(attrAmount):
new = input().split(" ")
attributes[new[0]] = int(new[1])
amountOfEvents = int(input())
events = []
highestEvents = {}
for i in range(amountOfEvents):
new = input().split(" ")
if new[0] not in highestEvents or int(new[1]) > highestEvents[new[0]]:
highestEvents[new[0]] = int(new[1])
events.append({
"name": new[0],
"points": int(new[1])
})
pointsNeeded = 0
for currentAttr in attributes:
pointsNeeded += highestEvents[currentAttr] - attributes[currentAttr]
if pointsNeeded > points: # check if we have enough points to pass
print(0)
exit(0)
for currentAttr in attributes: # assign enough point to every attribute to pass
diff = highestEvents[currentAttr] - attributes[currentAttr]
if diff > 0:
attributes[currentAttr] += diff
points -= diff
for i in range(points):
attributesBackUp = attributes.copy()
attributesResult = {}
for currentAttr in attributes:
attributes[currentAttr] += 1
attributesResult[currentAttr] = totalPoints()
attributes = attributesBackUp.copy()
best = max(attributesResult, key=attributesResult.get)
attributes[best] += 1
print(totalPoints())
詳細信息
answer.code:1:21: error: stray ‘#’ in program 1 | def totalPoints(): # calculate total points | ^ answer.code:34:28: error: stray ‘#’ in program 34 | if pointsNeeded > points: # check if we have enough points to pass | ^ answer.code:38:33: error: stray ‘#’ in program 38 | for currentAttr in attributes: # assign enough point to every attribute to pass | ^ answer.code:1:1: error: ‘def’ does not name a type 1 | def totalPoints(): # calculate total points | ^~~ answer.code:14:1: error: expected unqualified-id before ‘for’ 14 | for i in range(attrAmount): | ^~~ answer.code:21:1: error: expected unqualified-id before ‘for’ 21 | for i in range(amountOfEvents): | ^~~ answer.code:28:6: error: expected unqualified-id before ‘)’ token 28 | }) | ^ answer.code:47:5: error: expected unqualified-id before ‘for’ 47 | for currentAttr in attributes: | ^~~