답안 #1072266

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072266 2024-08-23T16:07:49 Z dwuy 악어의 지하 도시 (IOI11_crocodile) C++14
컴파일 오류
0 ms 0 KB
/**         - dwuy -
 
      />    フ
      |  _  _|
      /`ミ _x ノ
     /      |
    /   ヽ   ?
 / ̄|   | | |
 | ( ̄ヽ__ヽ_)_)
 \二つ
 
**/
#include <bits/stdc++.h>
#include "crocodile.h"
 
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define file(a) freopen(a".inp","r",stdin); freopen(a".out", "w",stdout)
#define fi first
#define se second
#define endl "\n"
#define len(s) (int)((s).size())
#define MASK(k)(1LL<<(k))
#define TASK "test"
 
using namespace std;
 
typedef tuple<int, int, int> tpiii;
typedef pair<double, double> pdd;
typedef pair<int, int> pii;
typedef long long ll;
 
const long long OO = 1e18;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int MX = 100005;
 
int n, m;
int cnt[MX];
vector<pii> G[MX];
 
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    n = N;
    m = M;
    for(int i=0; i<m; i++){
        int u = R[i][0] + 1;
        int v = R[i][1] + 1;
        int c = L[i];
        G[u].push_back({v, c});
        G[v].push_back({u, c});
    }
    
    priority_queue<pii, vector<pii>, greater<pii>> Q;
    for(int i=0; i<K; i++){
        int u = P[i] + 1;
        Q.push({0, u});
        d[u] = 0;
        cnt[u] = 1;
    }
    while(Q.size()){
        int du, u;
        tie(du, u) = Q.top();
        Q.pop();
        cnt[u]++;
        if(cnt[u] != 2) continue;
        if(u == 1) return du;
        for(pii edge: G[u]){
            int v, c;
            tie(v, c) = edge;
            if(cnt[v] < 2) Q.push({du + c, v});
        }
    }
    return -1;
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:56:9: error: 'd' was not declared in this scope
   56 |         d[u] = 0;
      |         ^