제출 #690575

#제출 시각아이디문제언어결과실행 시간메모리
690575saayan007악어의 지하 도시 (IOI11_crocodile)C++17
46 / 100
135 ms262144 KiB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
using vi = vector<int>;
using vl = vector<long long>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<long long, long long>>;

#define fur(i, a, b) for(ll i = a; i <= (ll)b; ++i)
#define ruf(i, a, b) for(ll i = a; i >= (ll)b; --i)
#define fr first 
#define sc second
#define mp make_pair
#define pb emplace_back
#define nl "\n"
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

const ll mxN = 1e3 + 1;
const ll inf = 1e18L;
#warning constants are according to subtask
vpl adj[mxN];
ll ans[mxN];

ll dfs(ll cur, ll src) {
    // cerr << cur << ' ';

    ll mx = inf;
    ll sm = inf;

    for(auto [ch, wt] : adj[cur]) {
        if(ch != src) {
            ll opt = dfs(ch, cur) + wt;
            if(opt < mx) {
                sm = mx;
                mx = opt;
            } else if(opt < sm) {
                sm = opt;
            }
        }
    }

    return (sm == inf ? 0 : sm);
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    fur(i, 0, M - 1) {
        ll a = R[i][0], b = R[i][1], wt = L[i];
        adj[a].pb(b, wt);
        adj[b].pb(a, wt);
        // cout << a << ' ' << b << ' ' << wt << nl;
    }

    // fur(i, 0, N - 1) {
        // cout << i << " : ";
        // for(auto [j, w] : adj[i]) {
            // cout << j << ',' << w << ' ';
        // }
        // cout << nl;
    // }
    return dfs(0, -1);
}

컴파일 시 표준 에러 (stderr) 메시지

crocodile.cpp:25:2: warning: #warning constants are according to subtask [-Wcpp]
   25 | #warning constants are according to subtask
      |  ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...