Submission #984516

#TimeUsernameProblemLanguageResultExecution timeMemory
984516user736482Two Transportations (JOI19_transportations)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<Azer.h> using namespace std; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>pq; int stan=9,akbit,czyt,czyt2,liczbaodwiedzonych=1,n,last; int odwiedzone[2137 + 1]; vector<pair<int, int>> sasiedzi[2000]; vector<int>answer; void sendInt(int a,int rozmiar){ vector<bool>v; for(int i=0;i<rozmiar;i++){ v.push_back(a%2); a/=2; } for(int i=rozmiar-1;i>=0;i++){ SendA(v[i]); } } void InitA(int N, int A, vector<int>U, vector<int>V, vector<int>C) { odwiedzone[0] = 1; n = N; for (int i = 1; i < N; i++) answer.push_back(9999999); 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]); } sendInt(pq.top().first,9); } void ReceiveA(bool y){ if(stan == 9){ czyt*=2; czyt+=y; akbit++; if(akbit==9){ if(liczbaodwiedzonych==n) return; liczbaodwiedzonych++; while(!pq.empty() && odwiedzone[pq.top().second]) pq.pop(); if(pq.empty()) pq.push({510,2137}); if(pq.top().first-last>czyt){ odwiedzone[pq.top().second] = 1; answer[pq.top().second] = pq.top().first.first; for (int i = 0; i < (int)sasiedzi[pq.top().second].size(); i++) { pq.push({ sasiedzi[pq.top().second][i].first + pq.top().first + last,sasiedzi[pq.top().second][i].second }); } last+ = pq.top().first; czyt=0; sendInt(pq.top().second,11); pq.pop(); while(!pq.empty() && odwiedzone[pq.top().second]) pq.pop(); if(pq.empty()) pq.push({510,2137}); sendInt(pq.top().first-last,9); } else{ stan=11; } akbit=0; } } if(stan==11){ czyt2*=2; czyt2+=y; akbit++; if(akbit==11){ akbit=0; answer[czyt2]=czyt+last; for (int i = 0; i < (int)sasiedzi[czyt2].size(); i++) { pq.push({ sasiedzi[czyt2][i].first + czyt + last,sasiedzi[pq.top().second][i].second }); } czyt=0; czyt2=0; while(!pq.empty() && odwiedzone[pq.top().second]) pq.pop(); if(pq.empty()) pq.push({510,2137}); sendInt(pq.top().first-last-czyt,9); last+=czyt; } } } vector<int>Answer(){ return answer; }
#include<bits/stdc++.h> #include<Baijan.h> using namespace std; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>pq; int stan=9,akbit,czyt,czyt2,liczbaodwiedzonych=1,n,last; int odwiedzone[2137 + 1]; vector<pair<int, int>> sasiedzi[2000]; vector<int>answer; void sendInt(int a,int rozmiar){ vector<bool>v; for(int i=0;i<rozmiar;i++){ v.push_back(a%2); a/=2; } for(int i=rozmiar-1;i>=0;i++){ SendB(v[i]); } } void InitB(int N, int B, vector<int>U, vector<int>V, vector<int>C) { odwiedzone[0] = 1; n = N; for (int i = 1; i < N; i++) answer.push_back(9999999); for (int i = 0; i < B; 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]); } sendInt(pq.top().first,9); } void ReceiveB(bool y){ if(stan == 9){ czyt*=2; czyt+=y; akbit++; if(akbit==9){ if(liczbaodwiedzonych==n) return; liczbaodwiedzonych++; while(!pq.empty() && odwiedzone[pq.top().second]) pq.pop(); if(pq.empty()) pq.push({510,2137}); if(pq.top().first-last>czyt){ odwiedzone[pq.top().second] = 1; answer[pq.top().second] = pq.top().first.first; for (int i = 0; i < (int)sasiedzi[pq.top().second].size(); i++) { pq.push({ sasiedzi[pq.top().second][i].first + pq.top().first + last,sasiedzi[pq.top().second][i].second }); } last+ = pq.top().first; czyt=0; sendInt(pq.top().second,11); pq.pop(); while(!pq.empty() && odwiedzone[pq.top().second]) pq.pop(); if(pq.empty()) pq.push({510,2137}); sendInt(pq.top().first-last,9); } else{ stan=11; } akbit=0; } } if(stan==11){ czyt2*=2; czyt2+=y; akbit++; if(akbit==11){ akbit=0; answer[czyt2]=czyt+last; for (int i = 0; i < (int)sasiedzi[czyt2].size(); i++) { pq.push({ sasiedzi[czyt2][i].first + czyt + last,sasiedzi[pq.top().second][i].second }); } czyt=0; czyt2=0; while(!pq.empty() && odwiedzone[pq.top().second]) pq.pop(); if(pq.empty()) pq.push({510,2137}); sendInt(pq.top().first-last-czyt,9); last+=czyt; } } }

Compilation message (stderr)

Azer.cpp: In function 'void ReceiveA(bool)':
Azer.cpp:51:58: error: request for member 'first' in 'pq.std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::top().std::pair<int, int>::first', which is of non-class type 'const int'
   51 |                 answer[pq.top().second] = pq.top().first.first;
      |                                                          ^~~~~
Azer.cpp:55:23: error: expected primary-expression before '=' token
   55 |                 last+ = pq.top().first;
      |                       ^

Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:51:58: error: request for member 'first' in 'pq.std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::top().std::pair<int, int>::first', which is of non-class type 'const int'
   51 |                 answer[pq.top().second] = pq.top().first.first;
      |                                                          ^~~~~
Baijan.cpp:55:23: error: expected primary-expression before '=' token
   55 |                 last+ = pq.top().first;
      |                       ^