Submission #983980

#TimeUsernameProblemLanguageResultExecution timeMemory
983980user736482Two Transportations (JOI19_transportations)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include<Azer.h> using namespace std; vector<int> answer,akliczby; int akwaga=1,akbit=-1,ak,state,rec,dist,ileod,n; vector<bool>tym; bool odwiedzone[2000]; pair<int,int>pqtop; vector<pair<int,int>> sasiedzi[2000]; priority_queue<pair<int,int>>pq; void InitA(int N, int A, vector<int>U,vector<int>V,vector<int>C ){ odwiedzone[0]=1; n=N; for(int i=0;i<N;i++){ answer.push_back(9999999); } answer[0]=0; for(int i=0;i<A;i++){ sasiedzi[U[i]].push_back({C[i],V[i]}); sasiedzi[V[i]].push_back({C[i],U[i]}); } for(int i=0;i<(int)sasiedzi[0].size();i++){ pq.push(sasiedzi[0][i]); } pqtop=pq.top(); ak=pqtop.first; for(int i=0;i<9;i++){ SendA(ak%2); ak/=2; } } void ReceiveA(bool x){ if(state==0){ tym.push_back(x); akbit++; if(akbit==9){ akbit=-1; rec=0; for(int i=8;i>=0;i--){ rec*=2; rec+=tym[i]; } /*!!!!!!!!*/if(rec<pqtop.first){ state=1; dist=rec; } else{ pq.pop(); ileod++; odwiedzone[pqtop.second]=1; answer[pqtop.second]=pqtop.first; for(int i=0;i<(int)sasiedzi[pqtop.second].size();i++){ pq.push({sasiedzi[pqtop.second][i].first+pqtop.first,sasiedzi[pqtop.second][i].second}); } ak=pqtop.second; for(int i=0;i<11;i++){ SendA(ak%2); ak/=2; } state=2; } } } if(state==1){ tym.push_back(x); akbit++; if(akbit==11){ akbit=-1; rec=0; for(int i=10;i>=0;i--){ rec*=2; rec+=tym[i]; } ileod++; odwiedzone[rec]=1; answer[rec]=dist; for(int i=0;i<(int)sasiedzi[rec].size();i++){ pq.push({sasiedzi[rec][i].first+dist,sasiedzi[rec][i].second}); } } pqtop=pq.top(); ak=pqtop.first; state=0; for(int i=0;i<9;i++){ SendA(ak%2); ak/=2; } } if(state==2){ tym.push_back(x); akbit++; if(akbit==9){ akbit=-1; rec=0; for(int i=8;i>=0;i--){ rec*=2; rec+=tym[i]; } pqtop=pq.top(); ak=pqtop.first; for(int i=0;i<9;i++){ SendA(ak%2); ak/=2; } /*!!!!!!!!*/if(rec<pqtop.first){ state=1; dist=rec; } else{ pq.pop(); ileod++; odwiedzone[pqtop.second]=1; answer[pqtop.second]=pqtop.first; for(int i=0;i<(int)sasiedzi[pqtop.second].size();i++){ pq.push({sasiedzi[pqtop.second][i].first+pqtop.first,sasiedzi[pqtop.second][i].second}); } ak=pqtop.second; for(int i=0;i<11;i++){ SendA(ak%2); ak/=2; } state=2; } } } } vector<int> Answer(){ return answer; }
#include<bits/stdc++.h> #include<Baijan.h> using namespace std; vector<int>answer; int odwiedzone[2000],ak,state,rec,dist,ileod=1; vector<bool>tym; vector<pair<int,int>> sasiedzi[2000]; priority_queue<pair<int,int>>pq; apir<int,int>pqtop; void InitB(int N, int B, vector<int>U,vector<int>V,vector<int>C ){ set<pair<int,pair<int,int>>>krawedzie; int akwaga=1,ak; for(int i=0;i<B;i++){ krawedzie.insert({C[i],{U[i],V[i]}}); } odwiedzone[0]=1; n=N; for(int i=0;i<N;i++){ answer.push_back(9999999); } answer[0]=0; for(int i=0;i<A;i++){ sasiedzi[U[i]].push_back({C[i],V[i]}); sasiedzi[V[i]].push_back({C[i],U[i]}); } for(int i=0;i<(int)sasiedzi[0].size();i++){ pq.push(sasiedzi[0][i]); } pqtop=pq.top(); ak=pqtop.first; for(int i=0;i<9;i++){ SendB(ak%2); ak/=2; } } void ReceiveB(bool y){ if(state==0){ tym.push_back(x); akbit++; if(akbit==9){ akbit=-1; rec=0; for(int i=8;i>=0;i--){ rec*=2; rec+=tym[i]; } /*!!!!!!!!*/if(rec<=pqtop.first){ state=1; dist=rec; } else{ pq.pop(); ileod++; odwiedzone[pqtop.second]=1; answer[pqtop.second]=pqtop.first; for(int i=0;i<(int)sasiedzi[pqtop.second].size();i++){ pq.push({sasiedzi[pqtop.second][i].first+pqtop.first,sasiedzi[pqtop.second][i].second}); } ak=pqtop.second; for(int i=0;i<11;i++){ SendB(ak%2); ak/=2; } state=2; } } } if(state==1){ tym.push_back(x); akbit++; if(akbit==11){ akbit=-1; rec=0; for(int i=10;i>=0;i--){ rec*=2; rec+=tym[i]; } ileod++; odwiedzone[rec]=1; answer[rec]=dist; for(int i=0;i<(int)sasiedzi[rec].size();i++){ pq.push({sasiedzi[rec][i].first+dist,sasiedzi[rec][i].second}); } } pqtop=pq.top(); ak=pqtop.first; state=0; for(int i=0;i<9;i++){ SendB(ak%2); ak/=2; } } if(state==2){ tym.push_back(x); akbit++; if(akbit==9){ akbit=-1; rec=0; for(int i=8;i>=0;i--){ rec*=2; rec+=tym[i]; } pqtop=pq.top(); ak=pqtop.first; for(int i=0;i<9;i++){ SendB(ak%2); ak/=2; } /*!!!!!!!!*/if(rec<=pqtop.first){ state=1; dist=rec; } else{ pq.pop(); ileod++; odwiedzone[pqtop.second]=1; answer[pqtop.second]=pqtop.first; for(int i=0;i<(int)sasiedzi[pqtop.second].size();i++){ pq.push({sasiedzi[pqtop.second][i].first+pqtop.first,sasiedzi[pqtop.second][i].second}); } ak=pqtop.second; for(int i=0;i<11;i++){ SendB(ak%2); ak/=2; } state=2; } } } }

Compilation message (stderr)

Baijan.cpp:10:1: error: 'apir' does not name a type
   10 | apir<int,int>pqtop;
      | ^~~~
Baijan.cpp: In function 'void InitB(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Baijan.cpp:19:5: error: 'n' was not declared in this scope
   19 |     n=N;
      |     ^
Baijan.cpp:24:19: error: 'A' was not declared in this scope
   24 |     for(int i=0;i<A;i++){
      |                   ^
Baijan.cpp:31:5: error: 'pqtop' was not declared in this scope
   31 |     pqtop=pq.top();
      |     ^~~~~
Baijan.cpp:14:9: warning: unused variable 'akwaga' [-Wunused-variable]
   14 |     int akwaga=1,ak;
      |         ^~~~~~
Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:40:23: error: 'x' was not declared in this scope
   40 |         tym.push_back(x);
      |                       ^
Baijan.cpp:41:9: error: 'akbit' was not declared in this scope
   41 |         akbit++;
      |         ^~~~~
Baijan.cpp:49:21: error: 'pqtop' was not declared in this scope
   49 | /*!!!!!!!!*/if(rec<=pqtop.first){
      |                     ^~~~~
Baijan.cpp:59:107: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   59 |                     pq.push({sasiedzi[pqtop.second][i].first+pqtop.first,sasiedzi[pqtop.second][i].second});
      |                                                                                                           ^
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:71:23: error: 'x' was not declared in this scope
   71 |         tym.push_back(x);
      |                       ^
Baijan.cpp:72:9: error: 'akbit' was not declared in this scope
   72 |         akbit++;
      |         ^~~~~
Baijan.cpp:87:9: error: 'pqtop' was not declared in this scope
   87 |         pqtop=pq.top();
      |         ^~~~~
Baijan.cpp:97:23: error: 'x' was not declared in this scope
   97 |         tym.push_back(x);
      |                       ^
Baijan.cpp:98:9: error: 'akbit' was not declared in this scope
   98 |         akbit++;
      |         ^~~~~
Baijan.cpp:106:13: error: 'pqtop' was not declared in this scope
  106 |             pqtop=pq.top();
      |             ^~~~~
Baijan.cpp:122:107: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
  122 |                     pq.push({sasiedzi[pqtop.second][i].first+pqtop.first,sasiedzi[pqtop.second][i].second});
      |                                                                                                           ^
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)
      |            ~~~~~~~~~~~~~^~~