Submission #943613

#TimeUsernameProblemLanguageResultExecution timeMemory
943613yeediotTwo Transportations (JOI19_transportations)C++14
Compilation error
0 ms0 KiB
#include "Azer.h" #include<bits/stdc++.h> using namespace std; namespace { const int mxn=5e5+5; int cur=0,n; vector<pair<int,int>>adj[mxn]; vector<int>dis(mxn); int prev=0; vector<bool>vis(mxn); bool first=1; pair<int,int>mn={(1<<9)-1,(1<<9)-1}; void send(int a,int b){ b--; for(;b>=0;b--){ SendB(a>>b&1); } } void gmn(){ d[mn.S]=prev+mn.F; prev=d[mn.S]; vis[mn.S]=1; for(auto [u,d]:mn.S){ d[u]=min(d[u],d[mn.S]+d); } for(int i=0;i<n;i++){ if(vis[i])continue; mn=min(mn,{d[i]-prev,i}); } } void gdis(){ if(cur==(1<<9)-1){ send(mn.S,11); gmn(); } else{ mn.F=cur; first=0; } cur=bit=0; } void gid(){ mn.S=cur; gmn(); cur=bit=0; first=1; } } // namespace void InitA(int N, int A, std::vector<int> U, std::vector<int> V,std::vector<int> C) { for(int i=0;i<A;i++){ adj[V[i]].push_back({U[i],C[i]}); adj[U[i]].push_back({V[i],C[i]}); } dis[0]=0; vis[0]=1; for(int i=1;i<=N;i++){ dis[i]=1e18; vis[i]=0; } int v=0; for(auto [u,d]:adj[v]){ dis[u]=min(dis[u],dis[v]+d); mn=min(mn,{dis[u],u}); } send(mn.F,9); } void ReceiveA(bool x) { cur=cur*2+x; bit++; if(bit==9 and first){ gdis(); } else if(bit==11){ gid(); } } std::vector<int> Answer() { return d; }
#include "Baijan.h" #include<bits/stdc++.h> using namespace std; namespace { const int mxn=5e5+5; int cur=0,n; vector<pair<int,int>>adj[mxn]; vector<int>dis(mxn); int prev=0; vector<bool>vis(mxn); bool first=1; pair<int,int>mn={(1<<9)-1,(1<<9)-1}; void send(int a,int b){ b--; for(;b>=0;b--){ SendB(a>>b&1); } } void gmn(){ d[mn.S]=prev+mn.F; prev=d[mn.S]; vis[mn.S]=1; for(auto [u,d]:mn.S){ d[u]=min(d[u],d[mn.S]+d); } for(int i=0;i<n;i++){ if(vis[i])continue; mn=min(mn,{d[i]-prev,i}); } } void gdis(){ if(mn.F>cur){ mn.F=cur; send((1<<9)-1,9); } else{ send(mn.F,9); send(mn.S,11); gmn(); first=0; } cur=bit=0; } void gid(){ mn.S=cur; gmn(); cur=bit=0; first=1; } } // namespace void InitB(int N, int B, std::vector<int> U, std::vector<int> V,std::vector<int> C) { for(int i=0;i<B;i++){ adj[V[i]].push_back({U[i],C[i]}); adj[U[i]].push_back({V[i],C[i]}); } n=N; dis[0]=0; vis[0]=1; for(int i=1;i<=N;i++){ dis[i]=1e18; vis[i]=0; } int v=0; for(auto [u,d]:adj[v]){ dis[u]=min(dis[u],dis[v]+d); mn=min(mn,{dis[u],u}); } } void ReceiveB(bool x) { cur=cur*2+x; bit++; if(bit==9 and first){ gdis(); } else if(bit==11){ gid(); } }

Compilation message (stderr)

Azer.cpp: In function 'void {anonymous}::send(int, int)':
Azer.cpp:16:13: error: 'SendB' was not declared in this scope; did you mean 'SendA'?
   16 |             SendB(a>>b&1);
      |             ^~~~~
      |             SendA
Azer.cpp: In function 'void {anonymous}::gmn()':
Azer.cpp:20:9: error: 'd' was not declared in this scope
   20 |         d[mn.S]=prev+mn.F;
      |         ^
Azer.cpp:20:14: error: 'struct std::pair<int, int>' has no member named 'S'
   20 |         d[mn.S]=prev+mn.F;
      |              ^
Azer.cpp:20:25: error: 'struct std::pair<int, int>' has no member named 'F'
   20 |         d[mn.S]=prev+mn.F;
      |                         ^
Azer.cpp:21:19: error: 'struct std::pair<int, int>' has no member named 'S'
   21 |         prev=d[mn.S];
      |                   ^
Azer.cpp:22:16: error: 'struct std::pair<int, int>' has no member named 'S'
   22 |         vis[mn.S]=1;
      |                ^
Azer.cpp:23:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   23 |         for(auto [u,d]:mn.S){
      |                  ^
Azer.cpp:23:27: error: 'struct std::pair<int, int>' has no member named 'S'
   23 |         for(auto [u,d]:mn.S){
      |                           ^
Azer.cpp:24:32: error: 'struct std::pair<int, int>' has no member named 'S'
   24 |             d[u]=min(d[u],d[mn.S]+d);
      |                                ^
Azer.cpp:28:36: error: no matching function for call to 'min(std::pair<int, int>&, <brace-enclosed initializer list>)'
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
In file included from /usr/include/c++/10/vector:60,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = std::pair<int, int>]'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:36: note:   no known conversion for argument 2 from '<brace-enclosed initializer list>' to 'const std::pair<int, int>&'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |                         ~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
Azer.cpp:28:36: note:   candidate expects 3 arguments, 2 provided
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
Azer.cpp:28:36: note:   'std::pair<int, int>' is not derived from 'std::initializer_list<_Tp>'
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Azer.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
Azer.cpp:28:36: note:   'std::pair<int, int>' is not derived from 'std::initializer_list<_Tp>'
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
Azer.cpp: In function 'void {anonymous}::gdis()':
Azer.cpp:33:21: error: 'struct std::pair<int, int>' has no member named 'S'
   33 |             send(mn.S,11);
      |                     ^
Azer.cpp:37:16: error: 'struct std::pair<int, int>' has no member named 'F'
   37 |             mn.F=cur;
      |                ^
Azer.cpp:40:13: error: 'bit' was not declared in this scope
   40 |         cur=bit=0;
      |             ^~~
Azer.cpp: In function 'void {anonymous}::gid()':
Azer.cpp:43:12: error: 'struct std::pair<int, int>' has no member named 'S'
   43 |         mn.S=cur;
      |            ^
Azer.cpp:45:13: error: 'bit' was not declared in this scope
   45 |         cur=bit=0;
      |             ^~~
Azer.cpp: In function 'void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Azer.cpp:57:16: warning: overflow in conversion from 'double' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} changes value from '1.0e+18' to '2147483647' [-Woverflow]
   57 |         dis[i]=1e18;
      |                ^~~~
Azer.cpp:61:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   61 |     for(auto [u,d]:adj[v]){
      |              ^
Azer.cpp:65:13: error: 'struct std::pair<int, int>' has no member named 'F'
   65 |     send(mn.F,9);
      |             ^
Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:70:5: error: 'bit' was not declared in this scope
   70 |     bit++;
      |     ^~~
Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:80:12: error: 'd' was not declared in this scope
   80 |     return d;
      |            ^
Azer.cpp: At global scope:
Azer.cpp:13:10: warning: 'void {anonymous}::send(int, int)' defined but not used [-Wunused-function]
   13 |     void send(int a,int b){
      |          ^~~~

Baijan.cpp: In function 'void {anonymous}::gmn()':
Baijan.cpp:20:9: error: 'd' was not declared in this scope
   20 |         d[mn.S]=prev+mn.F;
      |         ^
Baijan.cpp:20:14: error: 'struct std::pair<int, int>' has no member named 'S'
   20 |         d[mn.S]=prev+mn.F;
      |              ^
Baijan.cpp:20:25: error: 'struct std::pair<int, int>' has no member named 'F'
   20 |         d[mn.S]=prev+mn.F;
      |                         ^
Baijan.cpp:21:19: error: 'struct std::pair<int, int>' has no member named 'S'
   21 |         prev=d[mn.S];
      |                   ^
Baijan.cpp:22:16: error: 'struct std::pair<int, int>' has no member named 'S'
   22 |         vis[mn.S]=1;
      |                ^
Baijan.cpp:23:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   23 |         for(auto [u,d]:mn.S){
      |                  ^
Baijan.cpp:23:27: error: 'struct std::pair<int, int>' has no member named 'S'
   23 |         for(auto [u,d]:mn.S){
      |                           ^
Baijan.cpp:24:32: error: 'struct std::pair<int, int>' has no member named 'S'
   24 |             d[u]=min(d[u],d[mn.S]+d);
      |                                ^
Baijan.cpp:28:36: error: no matching function for call to 'min(std::pair<int, int>&, <brace-enclosed initializer list>)'
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
In file included from /usr/include/c++/10/vector:60,
                 from Baijan.h:7,
                 from Baijan.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'constexpr const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = std::pair<int, int>]'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:36: note:   no known conversion for argument 2 from '<brace-enclosed initializer list>' to 'const std::pair<int, int>&'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |                         ~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
Baijan.cpp:28:36: note:   candidate expects 3 arguments, 2 provided
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Baijan.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
Baijan.cpp:28:36: note:   'std::pair<int, int>' is not derived from 'std::initializer_list<_Tp>'
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from Baijan.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
Baijan.cpp:28:36: note:   'std::pair<int, int>' is not derived from 'std::initializer_list<_Tp>'
   28 |             mn=min(mn,{d[i]-prev,i});
      |                                    ^
Baijan.cpp: In function 'void {anonymous}::gdis()':
Baijan.cpp:32:15: error: 'struct std::pair<int, int>' has no member named 'F'
   32 |         if(mn.F>cur){
      |               ^
Baijan.cpp:33:16: error: 'struct std::pair<int, int>' has no member named 'F'
   33 |             mn.F=cur;
      |                ^
Baijan.cpp:37:21: error: 'struct std::pair<int, int>' has no member named 'F'
   37 |             send(mn.F,9);
      |                     ^
Baijan.cpp:38:21: error: 'struct std::pair<int, int>' has no member named 'S'
   38 |             send(mn.S,11);
      |                     ^
Baijan.cpp:42:13: error: 'bit' was not declared in this scope
   42 |         cur=bit=0;
      |             ^~~
Baijan.cpp: In function 'void {anonymous}::gid()':
Baijan.cpp:45:12: error: 'struct std::pair<int, int>' has no member named 'S'
   45 |         mn.S=cur;
      |            ^
Baijan.cpp:47:13: error: 'bit' was not declared in this scope
   47 |         cur=bit=0;
      |             ^~~
Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:60:16: warning: overflow in conversion from 'double' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} changes value from '1.0e+18' to '2147483647' [-Woverflow]
   60 |         dis[i]=1e18;
      |                ^~~~
Baijan.cpp:64:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   64 |     for(auto [u,d]:adj[v]){
      |              ^
Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:71:5: error: 'bit' was not declared in this scope
   71 |     bit++;
      |     ^~~