제출 #884531

#제출 시각아이디문제언어결과실행 시간메모리
884531Trisanu_Das사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" using namespace std; double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr){ vector<pair<int, int> > adj[N]; for(int i = 0; i < M; i++){ adj[x[i]].push_back({y[i], c[i]}); adj[y[i]].push_back({x[i], c[i]}); } long long dist[N]; fill(dist, dist + N, LLONG_MAX); dist[H] = 0; set<pair<long long, int> > s; s.insert({0, H}); while(!s.empty()){ auto latest = *s.begin(); s.erase(s.begin()); for(auto [c, co] : adj[latest.second]){ if(latest.first + co < d[c]) { auto f = s.find({dist[c], c}); if(f != s.end()) s.erase(f); dist[c] = latest.first + co; s.insert({dist[c], c}); } } } if(d[0 == LLONG_MAX]) return -1; long long ans = dist[0]; queue<int> q; q.push(0); bool vis[N] = {false}; vis[0] = vis[H] = true; while(!q.empty()){ int u = q.front(); q.pop(); if(!arr[u]) ans = min(ans, dist[u]); for(auto [v, co] : adj[u]){ if(!vis[v]){ vis[v] = true; q.push(v); } } } return ans; }

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

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:20:30: error: 'd' was not declared in this scope
   20 |       if(latest.first + co < d[c]) {
      |                              ^
cyberland.cpp:28:6: error: 'd' was not declared in this scope
   28 |   if(d[0 == LLONG_MAX]) return -1;
      |      ^