n, m = map(int, input().split())
s = list(map(int, input().split()))
q = []
for i in range(m):
test = []
test = list(map(int, input().split()))
q.append(test)
def tes():
tem = 1
for i in q:
v = i[1] - 1
for j in range(i[2] - i[1] + 1):
#print('v=', v+1)
s[v] = s[v] - i[0]
if s[v] < 0:
print(-1)
print(tem)
return False
v = v + 1
tem=tem+1
print(0)
tes()
全部评论
(10) 回帖