Submission #689769

#TimeUsernameProblemLanguageResultExecution timeMemory
689769zeroesandonesLost Array (NOI19_lostarray)C++17
100 / 100
28 ms2712 KiB
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i)
#define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i)
#define nl "\n"
#define sp " "

#define all(x) (x).begin(), (x).end()
#define sc second
#define fr first
#define pb emplace_back

void solve()
{
    ll n, m;
    cin >> n >> m;

    vi a(n + 1, 1);
    while(m--) {
        ll x, y, c;
        cin >> x >> y >> c;
        a[x] = max(a[x], c);
        a[y] = max(a[y], c);
    }

    for(int i = 1; i <= n; ++i)
        cout << a[i] << sp;
    cout << nl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}
#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...