第一题:打酱油
满分答案:(保证先还后借的方法借鉴博客)
n,k = map(int,input().split())
use = [[0 for i in range(3)] for j in range(k)]
key_num = []
use = []
for i in range(n):
key_num.append(i+1)
for i in range(k):
w,s,c = map(int,input().split())
use.append([s,1,w])
use.append([s+c,-1,w])
use.sort()
for i in range(2*k):
if use[i][1] == 1:
key_num[key_num.index(use[i][2])] = 0
if use[i][1] == -1:
key_num[key_num.index(0)] = use[i][2]
for i in range(n):
print(key_num[i],end=' ')