제출 #776264

#제출 시각아이디문제언어결과실행 시간메모리
776264Sharky사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include <bits/stdc++.h> using namespace std; #define int long long const double INF = 1E18; struct node { double di; int u, k; bool operator < (const node& o) const { if (k != o.k) return k > o.k; return di > o.di; } }; double solve(int32_t N, int32_t M, int32_t K, int32_t H, std::vector<int32_t> x, std::vector<int32_t> y, std::vector<int32_t> c, std::vector<int32_t> arr) { K = min(K, 80); vector<pair<int, int>> adj[N]; vector<vector<double>> d(N, vector<double> (K + 1, INF)); for (int i = 0; i < M; i++) { if (x[i] != H) adj[x[i]].push_back({y[i], c[i]}); if (y[i] != H) adj[y[i]].push_back({x[i], c[i]}); } queue<int> q; vector<bool> vis(N, 0); vis[0] = 1; q.push(0); while (!q.empty()) { int u = q.front(); q.pop(); for (auto& [v, w] : adj[u]) { if (!vis[v]) { vis[v] = true; q.push(v); } } } priority_queue<node> pq; pq.push({0.0, 0, 0}); d[0][0] = 0.0; for (int i = 0; i < N; i++) if (arr[i] == 0 && vis[i]) { pq.push({0.0, i, 0}); d[i][0] = 0.0; } while (!pq.empty()) { auto [di, u, k] = pq.top(); pq.pop(); if (di != d[u][k]) continue; for (auto& [v, w] : adj[u]) { double new_weight = d[u][k] + w; if (d[v][k] > new_weight) { d[v][k] = new_weight; pq.push((node) {d[v][k], v, k}); } if (arr[v] == 2 && k != K) { double new_weight = d[u][k] + w; new_weight /= 2.0; if (d[v][k + 1] > new_weight) { d[v][k + 1] = new_weight; pq.push((node) {d[v][k + 1], v, k + 1}); } } } } double res = *min_element(d[H].begin(), d[H].end()); if (res >=#include "cyberland.h" #include <bits/stdc++.h> using namespace std; #define int long long const double INF = 1E18; struct node { double di; int u, k; bool operator < (const node& o) const { if (k != o.k) return k > o.k; return di > o.di; } }; double solve(int32_t N, int32_t M, int32_t K, int32_t H, std::vector<int32_t> x, std::vector<int32_t> y, std::vector<int32_t> c, std::vector<int32_t> arr) { K = min(K, 80); vector<pair<int, int>> adj[N]; vector<vector<double>> d(N, vector<double> (K + 1, INF)); for (int i = 0; i < M; i++) { if (x[i] != H) adj[x[i]].push_back({y[i], c[i]}); if (y[i] != H) adj[y[i]].push_back({x[i], c[i]}); } queue<int> q; vector<bool> vis(N, 0); vis[0] = 1; q.push(0); while (!q.empty()) { int u = q.front(); q.pop(); for (auto& [v, w] : adj[u]) { if (!vis[v]) { vis[v] = true; q.push(v); } } } priority_queue<node> pq; pq.push({0.0, 0, 0}); d[0][0] = 0.0; for (int i = 0; i < N; i++) if (arr[i] == 0 && vis[i]) { pq.push({0.0, i, 0}); d[i][0] = 0.0; } while (!pq.empty()) { auto [di, u, k] = pq.top(); pq.pop(); if (di != d[u][k]) continue; for (auto& [v, w] : adj[u]) { double new_weight = d[u][k] + w; if (d[v][k] > new_weight) { d[v][k] = new_weight; pq.push((node) {d[v][k], v, k}); } if (arr[v] == 2 && k != K) { double new_weight = d[u][k] + w; new_weight /= 2.0; if (d[v][k + 1] > new_weight) { d[v][k + 1] = new_weight; pq.push((node) {d[v][k + 1], v, k + 1}); } } } } double res = *min_element(d[H].begin(), d[H].end()); if (res >= INF) return -1; return res; } INF) return -1; return res; }

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

cyberland.cpp:67:15: error: stray '#' in program
   67 |     if (res >=#include "cyberland.h"
      |               ^
cyberland.cpp: In function 'double solve(int32_t, int32_t, int32_t, int32_t, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:67:16: error: 'include' was not declared in this scope
   67 |     if (res >=#include "cyberland.h"
      |                ^~~~~~~
cyberland.cpp:72:24: error: expected ')' before ';' token
   72 | const double INF = 1E18;
      |                        ^
      |                        )
cyberland.cpp:67:8: note: to match this '('
   67 |     if (res >=#include "cyberland.h"
      |        ^
cyberland.cpp:83:156: error: a function-definition is not allowed here before '{' token
   83 | double solve(int32_t N, int32_t M, int32_t K, int32_t H, std::vector<int32_t> x, std::vector<int32_t> y, std::vector<int32_t> c, std::vector<int32_t> arr) {
      |                                                                                                                                                            ^
cyberland.cpp:135:6: error: expected ';' before ')' token
  135 | } INF) return -1;
      |      ^
      |      ;
cyberland.cpp:135:3: warning: statement has no effect [-Wunused-value]
  135 | } INF) return -1;
      |   ^~~