제출 #1009511

#제출 시각아이디문제언어결과실행 시간메모리
1009511Muaath_5사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast,O3,unroll-loops") #pragma GCC target("avx2,avx,sse3,sse4") #define F first #define S second #define pii pair<int, double> using namespace std; const ll mxN = 100000; const double inf = 1e18; struct path { int i, k; double val; }; bool operator<(const path &a, const path &b) { return a.val < b.val; } bool operator>(const path &a, const path &b) { return a.val > b.val; } double dp[mxN][69]; vector<pii> v[mxN]; double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { for (int i = 0; i < N; i++) v[i].clear(); K = min(K,68); for (int i = 0; i < M; i++) { v[x[i]].push_back({y[i], (double)c[i]}); v[y[i]].push_back({x[i], (double)c[i]}); } for(int i = 0;i < N;i++) for(int j = 0;j <= K;j++) dp[i][j] = inf; priority_queue<path,vector<path>,greater<path>>q; q.push({0,0,0}); dp[0][0] = 0; while(q.size()){ const auto u = q.top(); q.pop(); if(u.val < dp[u.i][u.k] || u.i == H) continue; for(const auto &x : v[u.i]){ if (arr[x.F] == 0 && dp[x.F][u.k] != (double)0) { dp[x.F][u.k] = (double)0; q.push({x.F, u.k, (double)0}); } if(dp[x.F][u.k] > dp[u.i][u.k] + x.S){ dp[x.F][u.k] = dp[u.i][u.k] + x.S; q.push({x.F,u.k,dp[x.F][u.k]}); } if(arr[u.i] == 2 && u.k != K && dp[x.F][u.k + 1] > dp[u.i][u.k] / 2 + x.S){ dp[x.F][u.k + 1] = dp[u.i][u.k] / 2 + x.S; q.push({x.F,u.k + 1,dp[x.F][u.k + 1]}); } } } double ans = inf; for(int i = 0;i <= K;i++){ ans = min(ans,dp[H][i]); } return ans == inf ? -1 : ans; }

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

cyberland.cpp:8:7: error: 'll' does not name a type
    8 | const ll mxN = 100000;
      |       ^~
cyberland.cpp:23:11: error: 'mxN' was not declared in this scope
   23 | double dp[mxN][69];
      |           ^~~
cyberland.cpp:24:15: error: 'mxN' was not declared in this scope
   24 | vector<pii> v[mxN];
      |               ^~~
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:28:5: error: 'v' was not declared in this scope
   28 |     v[i].clear();
      |     ^
cyberland.cpp:32:5: error: 'v' was not declared in this scope
   32 |     v[x[i]].push_back({y[i], (double)c[i]});
      |     ^
cyberland.cpp:37:7: error: 'dp' was not declared in this scope
   37 |       dp[i][j] = inf;
      |       ^~
cyberland.cpp:40:3: error: 'dp' was not declared in this scope
   40 |   dp[0][0] = 0;
      |   ^~
cyberland.cpp:45:25: error: 'v' was not declared in this scope
   45 |     for(const auto &x : v[u.i]){
      |                         ^
cyberland.cpp:49:37: error: no matching function for call to 'std::priority_queue<path, std::vector<path>, std::greater<path> >::push(<brace-enclosed initializer list>)'
   49 |         q.push({x.F, u.k, (double)0});
      |                                     ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = path; _Sequence = std::vector<path>; _Compare = std::greater<path>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = path]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const path&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = path; _Sequence = std::vector<path>; _Compare = std::greater<path>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = path]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<path, std::vector<path>, std::greater<path> >::value_type&&' {aka 'path&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp:53:38: error: no matching function for call to 'std::priority_queue<path, std::vector<path>, std::greater<path> >::push(<brace-enclosed initializer list>)'
   53 |         q.push({x.F,u.k,dp[x.F][u.k]});
      |                                      ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = path; _Sequence = std::vector<path>; _Compare = std::greater<path>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = path]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const path&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = path; _Sequence = std::vector<path>; _Compare = std::greater<path>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = path]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<path, std::vector<path>, std::greater<path> >::value_type&&' {aka 'path&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp:57:46: error: no matching function for call to 'std::priority_queue<path, std::vector<path>, std::greater<path> >::push(<brace-enclosed initializer list>)'
   57 |         q.push({x.F,u.k + 1,dp[x.F][u.k + 1]});
      |                                              ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = path; _Sequence = std::vector<path>; _Compare = std::greater<path>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = path]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const path&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = path; _Sequence = std::vector<path>; _Compare = std::greater<path>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = path]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<path, std::vector<path>, std::greater<path> >::value_type&&' {aka 'path&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~