Submission #886426

#TimeUsernameProblemLanguageResultExecution timeMemory
886426karimovTrading (IZhO13_trading)C++17
0 / 100
2091 ms2660 KiB
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fio(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout)
void YES(bool t=1){std::cout<<(t?"YES\n":"NO\n");}
void NO(bool t=1){YES(!t);}
const int MOD = 1000000007;
//#define int long long
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()

void solve() {
	int n,m;
	cin >> n >> m;
	vector<int> a,b,c;
	for(int i = 0; i < m; i++){
		int x,y,z;
		cin >> x >> y >> z;
		a.pb(x);
		b.pb(y);
		c.pb(z);
	}
	for(int i = 1; i <= n; i++) {
		int x=0;
		for(int j = 0; j < m; j++) {
			// cout << a[j] << " " << b[j] << " " << c[j] << endl;
			if(a[j]<=i&&b[j]>=i)x=max(x,c[j]+i-a[j]);
		}
		cout << x << " ";
	}
}

int main() {
	FAST
	solve();
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...