제출 #1215575

#제출 시각아이디문제언어결과실행 시간메모리
1215575qwusha봉쇄 시간 (IOI23_closing)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "closing.h"
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
ll inf = 1e18;

vector<vector<pair<ll, ll>>> g;

vector<ll> dist;
vector<int> v, u, w;

void dfs(ll x, ll d=0, ll p= -1) {
    dist[x] = min(dist[x], d);
    for (auto [y, ti] : g[x]) {
        if (p != y) {
            dfs(y, d + ti, v);
        }
    }
}



int max_score(int n, int x, int y, ll k, vector<int> U, vector<int> V, vector<int> W) {
    g.resize(n);
    v = V;
    u = U;
    w = W;
    for (int i = 0; i < n - 1; i++) {
        g[u[i]].push_back({v[i], w[i]});
        g[v[i]].push_back({u[i], w[i]});
    }
    dist.assign(n, inf);
    dfs(x);
    dfs(y);
    sort(dist.begin(), dist.end());
    int cnt = 0;
    for (ll i = 0; i < n; i++) {
        if (k >= dist[i]) {
            k -= dist[i];
            cnt++;
        } else {
            break;
        }
    }
    return cnt;
}

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

closing.cpp: In function 'void dfs(ll, ll, ll)':
closing.cpp:20:28: error: cannot convert 'std::vector<int>' to 'll' {aka 'long long int'}
   20 |             dfs(y, d + ti, v);
      |                            ^
      |                            |
      |                            std::vector<int>
closing.cpp:16:27: note:   initializing argument 3 of 'void dfs(ll, ll, ll)'
   16 | void dfs(ll x, ll d=0, ll p= -1) {
      |                        ~~~^~~~~