Submission #983975

#TimeUsernameProblemLanguageResultExecution timeMemory
983975user736482Two 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,rec,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)

Azer.cpp: In function 'void InitA(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
Azer.cpp:26:5: error: 'ak' was not declared in this scope
   26 |     ak=pqtop.first;
      |     ^~
Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:33:8: error: 'state' was not declared in this scope; did you mean '_xstate'?
   33 |     if(state==0){
      |        ^~~~~
      |        _xstate
Azer.cpp:45:17: error: 'dist' was not declared in this scope
   45 |                 dist=rec;
      |                 ^~~~
Azer.cpp:55:17: error: 'ak' was not declared in this scope
   55 |                 ak=pqtop.second;
      |                 ^~
Azer.cpp:64:8: error: 'state' was not declared in this scope; did you mean '_xstate'?
   64 |     if(state==1){
      |        ^~~~~
      |        _xstate
Azer.cpp:76:25: error: 'dist' was not declared in this scope
   76 |             answer[rec]=dist;
      |                         ^~~~
Azer.cpp:78:78: error: no matching function for call to 'std::priority_queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
   78 |                 pq.push({sasiedzi[rec][i].first+dist,sasiedzi[rec][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 Azer.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)
      |            ~~~~~~~~~~~~~^~~
Azer.cpp:82:9: error: 'ak' was not declared in this scope
   82 |         ak=pqtop.first;
      |         ^~
Azer.cpp:90:8: error: 'state' was not declared in this scope; did you mean '_xstate'?
   90 |     if(state==2){
      |        ^~~~~
      |        _xstate
Azer.cpp:101:13: error: 'ak' was not declared in this scope
  101 |             ak=pqtop.first;
      |             ^~
Azer.cpp:108:17: error: 'dist' was not declared in this scope
  108 |                 dist=rec;
      |                 ^~~~

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)
      |            ~~~~~~~~~~~~~^~~