Submission #943687

#TimeUsernameProblemLanguageResultExecution timeMemory
943687yeediotTwo Transportations (JOI19_transportations)C++17
Compilation error
0 ms0 KiB
#include "Azer.h" #include<bits/stdc++.h> using namespace std; #define S second #define F first #define int long long namespace { const int mxn=5e5+5; int cur=0,bit=0,n=0,cnt=0,prev=0,first=0; vector<pair<int,int>>adj[mxn]; vector<int>dis; vector<bool>vis; pair<int,int>mn={(1<<9)-1,(1<<9)-1}; void send(int a,int b){ b--; for(;b>=0;b--){ SendA(a>>b&1); } } void gmn(){ dis[mn.S]=prev+mn.F; prev=dis[mn.S]; cnt--; vis[mn.S]=1; for(auto [u,d]:adj[mn.S]){ dis[u]=min(dis[u],dis[mn.S]+d); } mn={(1<<9)-1,(1<<9)-1}; for(int i=0;i<n;i++){ if(vis[i])continue; mn=min(mn,{dis[i]-prev,i}); } if(cnt)send(mn.F,9); } 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]}); } n=N; cnt=n; first=1; bit=0; cur=0; prev=0; dis=vector<int>(N,1e9); vis=vector<bool>(N,0); dis[0]=0; vis[0]=1; cnt--; 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 dis; }

Compilation message (stderr)

Azer.cpp: In function 'void InitA(long long int, long long int, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
Azer.cpp:63:5: error: reference to 'prev' is ambiguous
   63 |     prev=0;
      |     ^~~~
Azer.cpp:9:31: note: candidates are: 'long long int {anonymous}::prev'
    9 |     int cur=0,bit=0,n=0,cnt=0,prev=0,first=0;
      |                               ^~~~
In file included from /usr/include/c++/10/bits/stl_algobase.h:66,
                 from /usr/include/c++/10/vector:60,
                 from Azer.h:6,
                 from Azer.cpp:1:
/usr/include/c++/10/bits/stl_iterator_base_funcs.h:224:5: note:                 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename std::iterator_traits<_Iter>::difference_type)'
  224 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
Azer.cpp: At global scope:
Azer.cpp:88:18: error: ambiguating new declaration of 'std::vector<long long int> Answer()'
   88 | std::vector<int> Answer() {
      |                  ^~~~~~
In file included from Azer.cpp:1:
Azer.h:11:18: note: old declaration 'std::vector<int> Answer()'
   11 | std::vector<int> Answer();
      |                  ^~~~~~

/usr/bin/ld: /tmp/ccA1bmaQ.o: in function `main':
grader_baijan.cpp:(.text.startup+0x174): undefined reference to `InitB(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader_baijan.cpp:(.text.startup+0x202): undefined reference to `ReceiveB(bool)'
collect2: error: ld returned 1 exit status