Submission #335385

#TimeUsernameProblemLanguageResultExecution timeMemory
335385strawberry2005Lost Array (NOI19_lostarray)C++14
32 / 100
11 ms1644 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]; 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]; else 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...