제출 #976742

#제출 시각아이디문제언어결과실행 시간메모리
976742Tsagana사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include <bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all(x) x.begin(), x.end() //#define int long long #define vi vector<int> #define pi pair<int, int > #define pq priority_queue #define lb lower_bound #define ub upper_bound #define pb push_back #define eb emplace_back #define mset multiset #define F first #define S second using namespace std; // START vector<pid> adj[100001]; double mindis[100001]; bool reach[100001]; int h, n; void dfs(int s) { reach[s] = 1; if (s == h) return ; for (auto i: adj[s]) if (!reach[i.F]) dfs(i.F); } void dij(vector<int>& arr) { pq<pdi> q; for (int i = 0; i < n; i++) if (reach[i] && mindis[i] < 1e18) q.push({mindis[i], i}); vector<bool> vis(n, 0); while (!q.empty()) { int s = q.top().S; q.pop(); if (vis[s]) continue ; vis[s] = 1; if (s == h) continue ; for (auto i: adj[s]) { if (reach[i.F] && !vis[i.F] && mindis[i.F] > mindis[s] + i.S) { mindis[i.F] = mindis[s] + i.S; q.push({mindis[i.F], i.F}); } } } vector<pid> tmp; for (int s = 0; s < n; s++) { double mn = mindis[s]; if (reach[s] && arr[s] == 2) { for (auto i: adj[s]) { if (reach[i.F] && i.F != h) mn = min(mn, (mindis[i.F] + i.S) / 2.0); } } if (mn < mindis[s]) tmp.pb({s, mn}); } for (auto i: tmp) mindis[i.F] = min(mindis[i.F], i.S); } double solve(int N, int M, int K, int H, vi x, vi y, vi c, vi arr) { h = H; n = N; K = min(K, 70); for (int i = 0; i < N; i++) { adj[i].clear(); reach[i] = 0; mindis[i] = 1e18; } for (int i = 0; i < M; i++) { adj[x[i]].pb({y[i], (double)c[i]}); adj[y[i]].pb({x[i], (double)c[i]}); } dfs(0); if (!reach[H]) return -1; mindis[0] = 0; for (int i = 1; i < N; i++) if (reach[i] && !arr[i]) mindis[i] = 0; for (int i = 0; i <= K; i++) dij(arr); return mindis[H]; } //END

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

cyberland.cpp:22:8: error: 'pid' was not declared in this scope; did you mean 'pi'?
   22 | vector<pid> adj[100001];
      |        ^~~
      |        pi
cyberland.cpp:22:11: error: template argument 1 is invalid
   22 | vector<pid> adj[100001];
      |           ^
cyberland.cpp:22:11: error: template argument 2 is invalid
cyberland.cpp: In function 'void dfs(int)':
cyberland.cpp:31:21: error: 'begin' was not declared in this scope
   31 |   for (auto i: adj[s])
      |                     ^
cyberland.cpp:31:21: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
cyberland.cpp:31:21: error: 'end' was not declared in this scope
   31 |   for (auto i: adj[s])
      |                     ^
cyberland.cpp:31:21: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
cyberland.cpp: In function 'void dij(std::vector<int>&)':
cyberland.cpp:35:6: error: 'pdi' was not declared in this scope; did you mean 'pi'?
   35 |   pq<pdi> q;
      |      ^~~
      |      pi
cyberland.cpp:35:9: error: template argument 1 is invalid
   35 |   pq<pdi> q;
      |         ^
cyberland.cpp:35:9: error: template argument 2 is invalid
cyberland.cpp:35:9: error: template argument 3 is invalid
cyberland.cpp:37:41: error: request for member 'push' in 'q', which is of non-class type 'int'
   37 |     if (reach[i] && mindis[i] < 1e18) q.push({mindis[i], i});
      |                                         ^~~~
cyberland.cpp:40:13: error: request for member 'empty' in 'q', which is of non-class type 'int'
   40 |   while (!q.empty()) {
      |             ^~~~~
cyberland.cpp:41:15: error: request for member 'top' in 'q', which is of non-class type 'int'
   41 |     int s = q.top().S; q.pop();
      |               ^~~
cyberland.cpp:41:26: error: request for member 'pop' in 'q', which is of non-class type 'int'
   41 |     int s = q.top().S; q.pop();
      |                          ^~~
cyberland.cpp:45:23: error: 'begin' was not declared in this scope
   45 |     for (auto i: adj[s]) {
      |                       ^
cyberland.cpp:45:23: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
cyberland.cpp:45:23: error: 'end' was not declared in this scope
   45 |     for (auto i: adj[s]) {
      |                       ^
cyberland.cpp:45:23: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
cyberland.cpp:48:11: error: request for member 'push' in 'q', which is of non-class type 'int'
   48 |         q.push({mindis[i.F], i.F});
      |           ^~~~
cyberland.cpp:52:10: error: 'pid' was not declared in this scope; did you mean 'pi'?
   52 |   vector<pid> tmp;
      |          ^~~
      |          pi
cyberland.cpp:52:13: error: template argument 1 is invalid
   52 |   vector<pid> tmp;
      |             ^
cyberland.cpp:52:13: error: template argument 2 is invalid
cyberland.cpp:56:25: error: 'begin' was not declared in this scope
   56 |       for (auto i: adj[s]) {
      |                         ^
cyberland.cpp:56:25: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
cyberland.cpp:56:25: error: 'end' was not declared in this scope
   56 |       for (auto i: adj[s]) {
      |                         ^
cyberland.cpp:56:25: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
cyberland.cpp:13:12: error: request for member 'push_back' in 'tmp', which is of non-class type 'int'
   13 | #define pb push_back
      |            ^~~~~~~~~
cyberland.cpp:60:29: note: in expansion of macro 'pb'
   60 |     if (mn < mindis[s]) tmp.pb({s, mn});
      |                             ^~
cyberland.cpp:62:16: error: 'begin' was not declared in this scope
   62 |   for (auto i: tmp) mindis[i.F] = min(mindis[i.F], i.S);
      |                ^~~
cyberland.cpp:62:16: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1224:5: note:   'std::begin'
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:549:3: note:   'std::filesystem::__cxx11::begin'
  549 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
cyberland.cpp:62:16: error: 'end' was not declared in this scope
   62 |   for (auto i: tmp) mindis[i.F] = min(mindis[i.F], i.S);
      |                ^~~
cyberland.cpp:62:16: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from cyberland.cpp:3:
/usr/include/c++/10/valarray:1244:5: note:   'std::end'
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
In file included from /usr/include/c++/10/filesystem:46,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from cyberland.cpp:3:
/usr/include/c++/10/bits/fs_dir.h:554:3: note:   'std::filesystem::__cxx11::end'
  554 |   end(recursive_directory_iterator) noexcept
      |   ^~~
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:68:12: error: request for member 'clear' in 'adj[i]', which is of non-class type 'int'
   68 |     adj[i].clear();
      |            ^~~~~
cyberland.cpp:13:12: error: request for member 'push_back' in 'adj[x.std::vector<int>::operator[](((std::vector<int>::size_type)i))]', which is of non-class type 'int'
   13 | #define pb push_back
      |            ^~~~~~~~~
cyberland.cpp:73:15: note: in expansion of macro 'pb'
   73 |     adj[x[i]].pb({y[i], (double)c[i]});
      |               ^~
cyberland.cpp:13:12: error: request for member 'push_back' in 'adj[y.std::vector<int>::operator[](((std::vector<int>::size_type)i))]', which is of non-class type 'int'
   13 | #define pb push_back
      |            ^~~~~~~~~
cyberland.cpp:74:15: note: in expansion of macro 'pb'
   74 |     adj[y[i]].pb({x[i], (double)c[i]});
      |               ^~