답안 #985071

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
985071 2024-05-17T10:23:40 Z reverberation 사이버랜드 (APIO23_cyberland) C++17
컴파일 오류
0 ms 0 KB
#define ll long long
#define pll pair<ll, ll>
#define fs first
#define sc second
#define pb push_back
double solve(ll n, ll m, ll k, ll h, vector<ll> x, vector<ll> y, vector<ll> c, vector<ll> v) {
    vector<vector<pll>> g(n + 1);
    for (ll i = 0; i < m; i++) {
        ll a = x[i] + 1, b = y[i] + 1, cost = c[i];
        g[a].pb({b, cost});
        g[b].pb({a, cost});
    }
    vector<ll> dist(n + 1, 1e9 + 10);
    dist[1] = 0;
    priority_queue<pll, vector<pll>, greater<pll>> q;
    q.push({0, 1});
    while (!q.empty()) {
        auto [curcost, v] = q.top();
        q.pop();
        if (curcost != dist[v]) continue;
        for (auto [to, cost] : g[v]) {
            if (dist[to] > dist[v] + cost) {
                dist[to] = dist[v] + cost;
                q.push({dist[to], to});
            }
        }
    }
    return dist[h];
}

Compilation message

cyberland.cpp:6:38: error: 'vector' has not been declared
    6 | double solve(ll n, ll m, ll k, ll h, vector<ll> x, vector<ll> y, vector<ll> c, vector<ll> v) {
      |                                      ^~~~~~
cyberland.cpp:6:44: error: expected ',' or '...' before '<' token
    6 | double solve(ll n, ll m, ll k, ll h, vector<ll> x, vector<ll> y, vector<ll> c, vector<ll> v) {
      |                                            ^
cyberland.cpp: In function 'double solve(long long int, long long int, long long int, long long int, int)':
cyberland.cpp:7:5: error: 'vector' was not declared in this scope
    7 |     vector<vector<pll>> g(n + 1);
      |     ^~~~~~
cyberland.cpp:2:13: error: 'pair' was not declared in this scope
    2 | #define pll pair<ll, ll>
      |             ^~~~
cyberland.cpp:7:19: note: in expansion of macro 'pll'
    7 |     vector<vector<pll>> g(n + 1);
      |                   ^~~
cyberland.cpp:1:12: error: expected primary-expression before 'long'
    1 | #define ll long long
      |            ^~~~
cyberland.cpp:2:18: note: in expansion of macro 'll'
    2 | #define pll pair<ll, ll>
      |                  ^~
cyberland.cpp:7:19: note: in expansion of macro 'pll'
    7 |     vector<vector<pll>> g(n + 1);
      |                   ^~~
cyberland.cpp:9:16: error: 'x' was not declared in this scope
    9 |         ll a = x[i] + 1, b = y[i] + 1, cost = c[i];
      |                ^
cyberland.cpp:10:9: error: 'g' was not declared in this scope
   10 |         g[a].pb({b, cost});
      |         ^
cyberland.cpp:10:18: error: 'b' was not declared in this scope
   10 |         g[a].pb({b, cost});
      |                  ^
cyberland.cpp:10:21: error: 'cost' was not declared in this scope
   10 |         g[a].pb({b, cost});
      |                     ^~~~
cyberland.cpp:1:12: error: expected primary-expression before 'long'
    1 | #define ll long long
      |            ^~~~
cyberland.cpp:13:12: note: in expansion of macro 'll'
   13 |     vector<ll> dist(n + 1, 1e9 + 10);
      |            ^~
cyberland.cpp:14:5: error: 'dist' was not declared in this scope
   14 |     dist[1] = 0;
      |     ^~~~
cyberland.cpp:15:5: error: 'priority_queue' was not declared in this scope
   15 |     priority_queue<pll, vector<pll>, greater<pll>> q;
      |     ^~~~~~~~~~~~~~
cyberland.cpp:1:12: error: expected primary-expression before 'long'
    1 | #define ll long long
      |            ^~~~
cyberland.cpp:2:18: note: in expansion of macro 'll'
    2 | #define pll pair<ll, ll>
      |                  ^~
cyberland.cpp:15:20: note: in expansion of macro 'pll'
   15 |     priority_queue<pll, vector<pll>, greater<pll>> q;
      |                    ^~~
cyberland.cpp:16:5: error: 'q' was not declared in this scope
   16 |     q.push({0, 1});
      |     ^
cyberland.cpp:21:32: error: 'g' was not declared in this scope
   21 |         for (auto [to, cost] : g[v]) {
      |                                ^