Submission #983842

#TimeUsernameProblemLanguageResultExecution timeMemory
983842user736482Two Transportations (JOI19_transportations)C++17
0 / 100
208 ms1600 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; set<pair<int,pair<int,int>>>krawedzie; bool odwiedzone[2000]; pair<int,int>akkrawedz; 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++){ krawedzie.insert({C[i],{U[i],V[i]}}); } } void ReceiveA(bool x){ if(akbit==-1){ if(!x) akbit=0; else akwaga++; } else{ tym.push_back(x); akbit++; if(akbit==11){ akbit=-1; rec=0; for(int i=10;i>=0;i--){ rec*=2; rec+=tym[i]; } akliczby.push_back(rec); if(akliczby.size()==2){ krawedzie.insert({akwaga,{akliczby[0],akliczby[1]}}); akliczby.clear(); } } } if((int)krawedzie.size()==n-1){ for(auto i=krawedzie.begin();i!=krawedzie.end();i++){ sasiedzi[(*i).second.first-1].push_back({(*i).first,(*i).second.second-1}); sasiedzi[(*i).second.second-1].push_back({(*i).first,(*i).second.first-1}); } for(int i=0;i<(int)sasiedzi[0].size();i++){ pq.push(sasiedzi[0][i]); } ileod=1; while(ileod!=n){ akkrawedz=pq.top(); pq.pop(); if(!odwiedzone[akkrawedz.second]){ ileod++; odwiedzone[akkrawedz.second]=1; answer[akkrawedz.second]=akkrawedz.first; for(int i=0;i<(int)sasiedzi[akkrawedz.second].size();i++){ pq.push({sasiedzi[akkrawedz.second][i].first+akkrawedz.first,sasiedzi[akkrawedz.second][i].second}); } } } } } vector<int> Answer(){ return answer; }
#include<bits/stdc++.h> #include<Baijan.h> using namespace std; 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]}}); } for(auto i=krawedzie.begin();i!=krawedzie.end();i++){ while((*i).first>akwaga){ akwaga++; SendB(1); } SendB(0); ak=(*i).second.first; for(int i=0;i<11;i++){ SendB(ak%2); ak/=2; } ak=(*i).second.second; for(int i=0;i<11;i++){ SendB(ak%2); ak/=2; } } } void ReceiveB(bool y){ }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...