제출 #1346978

#제출 시각아이디문제언어결과실행 시간메모리
1346978Born_To_Laugh악어의 지하 도시 (IOI11_crocodile)C++17
컴파일 에러
0 ms0 KiB
// Born_To_Laugh - Hughie Do
#include "crocodile.h"
#include <bits/stdc++.h>
#define alle(AC) AC.begin(), AC.end()
#define fi first
#define se second
using namespace std;
typedef ll ll;
[[maybe_unused]] const int MOD = 998244353, INF = 1e9 + 7;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
    vector<vector<pair<int, ll>>> adj(N);
    for (int i = 0; i < M; i++) {
        int u = R[i][0];
        int v = R[i][1];
        ll w = L[i];
        adj[u].push_back({v, w});
        adj[v].push_back({u, w});
    }
    vector<int> vis(N, 0);
    
    priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> pq;
    for (int i = 0; i < K; i++) {
        vis[P[i]] = 1;
        pq.push({0, P[i]});
    }

    while (!pq.empty()) {
        ll d = pq.top().first;
        int u = pq.top().second;
        pq.pop();
        
        vis[u]++;
        if (vis[u] > 2) continue;
        else if (vis[u] == 1) continue;

        if (u == 0) return d;
        for (auto edge : adj[u]) {
            int v = edge.first;
            ll w = edge.second;
            if (vis[v] < 2) {
                pq.push({d + w, v});
            }
        }
    }
}

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

crocodile.cpp:8:9: error: 'll' does not name a type
    8 | typedef ll ll;
      |         ^~
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:11:29: error: 'll' was not declared in this scope
   11 |     vector<vector<pair<int, ll>>> adj(N);
      |                             ^~
crocodile.cpp:11:29: error: template argument 2 is invalid
crocodile.cpp:11:31: error: template argument 1 is invalid
   11 |     vector<vector<pair<int, ll>>> adj(N);
      |                               ^~
crocodile.cpp:11:31: error: template argument 2 is invalid
crocodile.cpp:11:33: error: template argument 1 is invalid
   11 |     vector<vector<pair<int, ll>>> adj(N);
      |                                 ^
crocodile.cpp:11:33: error: template argument 2 is invalid
crocodile.cpp:15:11: error: expected ';' before 'w'
   15 |         ll w = L[i];
      |           ^~
      |           ;
crocodile.cpp:16:12: error: invalid types 'int[int]' for array subscript
   16 |         adj[u].push_back({v, w});
      |            ^
crocodile.cpp:16:30: error: 'w' was not declared in this scope
   16 |         adj[u].push_back({v, w});
      |                              ^
crocodile.cpp:17:12: error: invalid types 'int[int]' for array subscript
   17 |         adj[v].push_back({u, w});
      |            ^
crocodile.cpp:21:54: error: template argument 1 is invalid
   21 |     priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> pq;
      |                                                      ^~
crocodile.cpp:21:54: error: template argument 2 is invalid
crocodile.cpp:21:66: error: template argument 1 is invalid
   21 |     priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> pq;
      |                                                                  ^~
crocodile.cpp:21:66: error: template argument 2 is invalid
crocodile.cpp:24:12: error: request for member 'push' in 'pq', which is of non-class type 'int'
   24 |         pq.push({0, P[i]});
      |            ^~~~
crocodile.cpp:27:16: error: request for member 'empty' in 'pq', which is of non-class type 'int'
   27 |     while (!pq.empty()) {
      |                ^~~~~
crocodile.cpp:28:11: error: expected ';' before 'd'
   28 |         ll d = pq.top().first;
      |           ^~
      |           ;
crocodile.cpp:29:20: error: request for member 'top' in 'pq', which is of non-class type 'int'
   29 |         int u = pq.top().second;
      |                    ^~~
crocodile.cpp:30:12: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   30 |         pq.pop();
      |            ^~~
crocodile.cpp:36:28: error: 'd' was not declared in this scope
   36 |         if (u == 0) return d;
      |                            ^
crocodile.cpp:37:29: error: invalid types 'int[int]' for array subscript
   37 |         for (auto edge : adj[u]) {
      |                             ^
crocodile.cpp:39:15: error: expected ';' before 'w'
   39 |             ll w = edge.second;
      |               ^~
      |               ;
crocodile.cpp:41:20: error: request for member 'push' in 'pq', which is of non-class type 'int'
   41 |                 pq.push({d + w, v});
      |                    ^~~~
crocodile.cpp:41:26: error: 'd' was not declared in this scope
   41 |                 pq.push({d + w, v});
      |                          ^
crocodile.cpp:41:30: error: 'w' was not declared in this scope
   41 |                 pq.push({d + w, v});
      |                              ^