QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#688139 | #9528. New Energy Vehicle | white_two | Compile Error | / | / | C++14 | 1.4kb | 2024-10-29 23:41:07 | 2024-10-29 23:41:07 |
Judging History
This is the latest submission verdict.
- [2024-10-29 23:41:07]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-10-29 23:41:07]
- Submitted
answer
import heapq
t = int(input())
for _ in range(t):
n,m = map(int,input().split())
line = list(map(int,input().split()))
store = line.copy()
rest = sum(line)
p = []
q = []
dis = 0
f = 1
vis = set()
for i in range(m):
x,t = map(int,input().split())
heapq.heappush(p,(x,t))
q.append((x,t))
for i in range(1,n+1):
heapq.heappush(p,(10**12,i))
for x,t in q:
cost = x - dis
vis = set()
tmp = []
if cost > rest:
f = 0
print(dis + rest)
break
while cost > 0 and p:
idx,i = heapq.heappop(p)
if i in vis:
tmp.append((idx,i))
continue
vis.add(i)
if store[i-1] <= cost:
cost -= store[i-1]
rest -= store[i-1]
store[i-1] = 0
else:
heapq.heappush(p,(idx,i))
store[i-1] -= cost
rest -= cost
cost = 0
for idx,ix in tmp:
heapq.heappush(p,(idx,ix))
rest += line[t-1] - store[t-1]
store[t-1] = line[t-1]
dis = x
cur_d,ixx = heapq.heappop(p)
while cur_d <= dis:
cur_d,ixx = heapq.heappop(p)
heapq.heappush(p,(cur_d,ixx))
if f:
print(dis+rest)
详细
answer.code:1:1: error: ‘import’ does not name a type 1 | import heapq | ^~~~~~ answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’