답안 #689769

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
689769 2023-01-29T10:48:35 Z zeroesandones Lost Array (NOI19_lostarray) C++17
100 / 100
28 ms 2712 KB
#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();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 6 ms 1108 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 4 ms 980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 6 ms 1108 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 4 ms 980 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 8 ms 596 KB Output is correct
3 Correct 6 ms 468 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 6 ms 1108 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 4 ms 980 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 8 ms 596 KB Output is correct
18 Correct 6 ms 468 KB Output is correct
19 Correct 4 ms 460 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 12 ms 1572 KB Output is correct
22 Correct 14 ms 1640 KB Output is correct
23 Correct 16 ms 1588 KB Output is correct
24 Correct 18 ms 2076 KB Output is correct
25 Correct 28 ms 2712 KB Output is correct