제출 #1071956

#제출 시각아이디문제언어결과실행 시간메모리
1071956Halym2007사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
v#include <bits/stdc++.h> using namespace std; #define ll long long #define sz size() #define ff first #define ss second #define pb push_back #define pii pair <double, int> const int N = 2e5 + 5; const int git = 70; vector <pair <int, int>> v[N]; double dis[git][N]; set <pii> q[N]; int n, m, k, h; double jogap = 1e16; bool vis[N]; void dfs (ll x) { vis[x] = 1; for (auto i : v[x]) { if (vis[i.ff]) continue; dfs(i.ff); } } double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> a) { n = N;m = M;k = K;h = H; for (int i = 0; i < m; ++i) { v[x[i]].pb ({y[i], c[i]}); v[y[i]].pb ({x[i], c[i]}); } jogap = 1e16; vis[h] = 1; if (k >= git - 1) k = git - 2; dfs (0); for (int i = 0; i < n; ++i) { for (int j = 0; j < git; ++j) { dis[j][i] = 1e16; } } q[0].insert ({0, 0}); dis[0][0] = 0; for (int i = 0; i < n; ++i) { if (!a[i] and vis[i]) { q[0].insert ({0, i}); dis[0][i] = 0; } } for (int i = 0; i <= k; ++i) { while (!q[i].empty()) { int x = (*q[i].begin()).ss; q[i].erase(q[i].begin()); if (x == h) continue; for (auto j : v[x]) { double val = dis[i][x] + j.ss; if (val < dis[i][j.ff]) { dis[i][j.ff] = val; q[i].insert ({val, j.ff}); } if (a[j.ff] == 2) { val /= 2; if (dis[i + 1][j.ff] > val) { dis[i + 1][j.ff] = val; q[i + 1].insert ({val, j.ff}); } } } } jogap = min (jogap, dis[i][h]); } if (jogap == (double)1e16) jogap = -1; for (int i = 0; i < n; ++i) { v[i].clear(); vis[i] = 0; } for (int i = 0; i < git; ++i) { q[i].clear(); } return jogap; } //int main() { // freopen ("input.txt", "r", stdin); // int T; // assert(1 == scanf("%d", &T)); // while (T--){ // int N,M,K,H; // assert(4 == scanf("%d %d %d\n%d", &N, &M, &K, &H)); // std::vector<int> x(M); // std::vector<int> y(M); // std::vector<int> c(M); // std::vector<int> arr(N); // for (int i=0;i<N;i++) // assert(1 == scanf("%d", &arr[i])); // for (int i=0;i<M;i++) // assert(3 == scanf("%d %d %d", &x[i], &y[i], &c[i])); // printf("%.12lf\n", solve(N, M, K, H, x, y, c, arr)); // } //}

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

cyberland.cpp:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
cyberland.cpp:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
cyberland.cpp:11:1: error: 'vector' does not name a type
   11 | vector <pair <int, int>> v[N];
      | ^~~~~~
cyberland.cpp:13:1: error: 'set' does not name a type
   13 | set <pii> q[N];
      | ^~~
cyberland.cpp: In function 'void dfs(long long int)':
cyberland.cpp:20:16: error: 'v' was not declared in this scope
   20 |  for (auto i : v[x]) {
      |                ^
cyberland.cpp: At global scope:
cyberland.cpp:27:42: error: 'vector' has not been declared
   27 | double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> a) {
      |                                          ^~~~~~
cyberland.cpp:27:48: error: expected ',' or '...' before '<' token
   27 | double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> a) {
      |                                                ^
cyberland.cpp: In function 'double solve(int, int, int, int, int)':
cyberland.cpp:30:3: error: 'v' was not declared in this scope
   30 |   v[x[i]].pb ({y[i], c[i]});
      |   ^
cyberland.cpp:30:5: error: 'x' was not declared in this scope
   30 |   v[x[i]].pb ({y[i], c[i]});
      |     ^
cyberland.cpp:30:16: error: 'y' was not declared in this scope
   30 |   v[x[i]].pb ({y[i], c[i]});
      |                ^
cyberland.cpp:30:22: error: 'c' was not declared in this scope
   30 |   v[x[i]].pb ({y[i], c[i]});
      |                      ^
cyberland.cpp:42:2: error: 'q' was not declared in this scope
   42 |  q[0].insert ({0, 0});
      |  ^
cyberland.cpp:45:8: error: 'a' was not declared in this scope
   45 |   if (!a[i] and vis[i]) {
      |        ^
cyberland.cpp:55:18: error: 'v' was not declared in this scope
   55 |    for (auto j : v[x]) {
      |                  ^
cyberland.cpp:61:9: error: 'a' was not declared in this scope
   61 |     if (a[j.ff] == 2) {
      |         ^
cyberland.cpp:70:11: error: 'min' was not declared in this scope
   70 |   jogap = min (jogap, dis[i][h]);
      |           ^~~
cyberland.cpp:75:3: error: 'v' was not declared in this scope
   75 |   v[i].clear();
      |   ^