# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
493495 | White | Trading (IZhO13_trading) | C++14 | 1 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int pos[300002],krai[300002],ans[300002];
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n,k,x,y,z;
cin>>n>>k;
for(int i=0;i<k;i++){
cin>>x>>y>>z;
if(z>pos[x]){
pos[x]=z;
krai[x]=y;
}
}
long long now=0,doK=100000000;
for(int i=1;i<=n;i++){
if(pos[i]>now){
now=pos[i];
doK=krai[i];
}
if(now>0 && doK==i){
ans[i]=now;
doK=10000000000;
now=0;
}else{
ans[i]=now;
now++;
}
}
for(int i=1;i<=n;i++)cout<<ans[i]<<" ";
cout<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |