Submission #336736

#TimeUsernameProblemLanguageResultExecution timeMemory
336736strawberry2005Lost Array (NOI19_lostarray)C++14
100 / 100
34 ms3820 KiB
#include<bits/stdc++.h> #define deb(x) cout << #x << ": " << x << endl #define ll long long using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n,m; cin>>n>>m; vector<int> ans(n,1e9),inp2(m); vector<pair<int,int>> inp(m); for(int i=0;i<m;i++) cin>>inp[i].first>>inp[i].second>>inp2[i]; //sort(inp.begin(),inp.end()); for(int i=0;i<m;i++){ if(ans[inp[i].first-1]<inp2[i]||ans[inp[i].first-1]==1e9) ans[inp[i].first-1]=inp2[i]; if(ans[inp[i].second-1]<inp2[i]||ans[inp[i].second-1]==1e9) ans[inp[i].second-1]=inp2[i]; } for(int i=0;i<n;i++) cout<<ans[i]<<" "; return(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...