Submission #708227

#TimeUsernameProblemLanguageResultExecution timeMemory
708227alvingogoTwo Transportations (JOI19_transportations)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "Azer.h" #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue using namespace std; namespace{ vector<int> dis; int n; int m; vector<vector<pair<int,int> > > gg; int nw,f=-1,r=-1,c=-1; int cnt=0; int flag=-1; int z=0; } void InitA(int N, int A, std::vector<int> U, std::vector<int> V, std::vector<int> C){ n=N; m=A; gg.resize(n); for(int i=0;i<m;i++){ gg[U[i]].push_back({V[i],C[i]}); gg[V[i]].push_back({V[i],C[i]}); } } void ReceiveA(bool x){ if(flag==-1){ flag=x; return; } nw=nw*2+x; cnt++; if(flag==0){ if(cnt==20){ dis[z]=nw; nw=0; cnt=0; z++; } } else{ if(cnt==11){ if(f==-1){ f=nw; } else if(r==-1){ r=nw; } else if(c==-1){ c=nw; gg[f].push_back({r,c}); gg[r].push_back({f,c}); } else{ assert(0); } cnt=0; nw=0; } } } std::vector<int> Answer(){ if(flag){ p_q<pair<int,int> > pq; pq.push({0,0}); while(pq.size()){ auto h=pq.top(); pq.pop(); h.fs*=-1; if(h.fs!=dis[h.sc]){ continue; } for(auto y:gg[h.sc]){ if(dis[y.fs]>h.fs+y.sc){ dis[y.fs]=h.fs+y.sc; pq.push({-dis[y.fs],y.fs}); } } } } return dis; }
#include <bits/stdc++.h> #include "Baijan.h" #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue using namespace std; void send(int a,int i){ i--; for(;i>=0;i--){ sendB((a>>i)&1); } } void InitB(int N, int B, std::vector<int> S, std::vector<int> T, std::vector<int> D){ if(B<=1000){ sendB(1); for(int i=0;i<B;i++){ send(S[i],11); send(T[i],11); send(D[i],11); } } else{ sendB(0); vector<int> dis(N); vector<vector<pair<int,int> > gg(N); for(int i=0;i<B;i++){ gg[S[i]].push_back({T[i],D[i]}); gg[T[i]].push_back({T[i],D[i]}); } p_q<pair<int,int> > pq; pq.push({0,0}); while(pq.size()){ auto h=pq.top(); pq.pop(); h.fs*=-1; if(h.fs!=dis[h.sc]){ continue; } for(auto y:gg[h.sc]){ if(dis[y.fs]>h.fs+y.sc){ dis[y.fs]=h.fs+y.sc; pq.push({-dis[y.fs],y.fs}); } } } for(int i=0;i<n;i++){ send(dis[i],20); } } }

Compilation message (stderr)

Baijan.cpp: In function 'void send(int, int)':
Baijan.cpp:13:9: error: 'sendB' was not declared in this scope; did you mean 'send'?
   13 |         sendB((a>>i)&1);
      |         ^~~~~
      |         send
Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:18:9: error: 'sendB' was not declared in this scope; did you mean 'send'?
   18 |         sendB(1);
      |         ^~~~~
      |         send
Baijan.cpp:26:9: error: 'sendB' was not declared in this scope; did you mean 'send'?
   26 |         sendB(0);
      |         ^~~~~
      |         send
Baijan.cpp:28:43: error: template argument 1 is invalid
   28 |         vector<vector<pair<int,int> > gg(N);
      |                                           ^
Baijan.cpp:28:43: error: template argument 2 is invalid
Baijan.cpp:30:13: error: 'gg' was not declared in this scope
   30 |             gg[S[i]].push_back({T[i],D[i]});
      |             ^~
Baijan.cpp:42:24: error: 'gg' was not declared in this scope
   42 |             for(auto y:gg[h.sc]){
      |                        ^~
Baijan.cpp:45:46: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   45 |                     pq.push({-dis[y.fs],y.fs});
      |                                              ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from Baijan.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 = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]'
  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 std::pair<int, int>&'}
  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 = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]'
  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<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
Baijan.cpp:49:23: error: 'n' was not declared in this scope
   49 |         for(int i=0;i<n;i++){
      |                       ^