//上下两个都只有10分,不知道哪错了 ....
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include <cstring>
using namespace std;
typedef pair<int, int> PAIR;
bool cmp_by_value(const PAIR& lhs, const PAIR& rhs) {
return lhs.second < rhs.second;
}
struct CmpByValue {
bool operator()(const PAIR& lhs, const PAIR& rhs) {
return lhs.second < rhs.second;
}
};
int main() {
int m, n;
cin >> m >> n;
map<int, int> a;
int k = 1, c[n+5];
for(int i=0; i<n; i++){
int t, te, t2;
cin >> t >> te >> t2;
a[t] = max(a[t], te+t2);
}
vector<PAIR> b(a.begin(), a.end());
sort(b.begin(), b.end(), CmpByValue());
memset(c, 0, sizeof(c));
for(int i=1; i<=m; i++)
if(a[i] == 0)//未被拿走
c[k++] = i;
//cout << c[1];
sort(c, c+k);
/*for(int i=1; i<k; i++)
cout << c[i] << " ";
cout << endl;
*/
// sort(name_score_vec.begin(), name_score_vec.end(), cmp_by_value);
{
for(int i=0,j=1,p=1; j<=m; ++j) {
if(c[p] == j && p<=k ) {
cout << j << " ";
p++;
}
else {
cout << b[i].first << " ";
i++;
}
}
}
return 0;
}
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
int m, n;
cin >> m >> n;
int a[m+1]={0}, b[m+1]={0};//b用来查找原来的位置
for(int i=0; i<n; i++){
int t, te, c;
cin >> t >> te >> c;
a[t-1] = max(a[t-1], te+c);
b[t-1] = max(b[t-1], te+c);
}
sort(a, a+m);//a内从小到大排序
for(int i=0; i<m; i++)
{
for(int j=0; j<m; j++){
if(a[i] == b[j]){
cout << j+1 << " ";
b[j] = -1;
break;
}
}
}
return 0;
}