# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
992626 | MarwenElarbi | Two Transportations (JOI19_transportations) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Azer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
vector<pair<int,int>> adja[2005];
int n;
vector<int> ans;
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,std::vector<int> C){
n=N;
for (int i = 0; i < A; ++i)
{
adja[U[i]].pb({V[i],C[i]});
adja[V[i]].pb({U[i],C[i]});
}
}
void ReceiveA(bool x) {
ans.pb(x);
}
std::vector<int> Answer() {
vector<int> res;
for (int i = 0; i < ans.size(); i+=20)
{
int cur=0;
for (int j = 0; j < 20; ++j)
{
cur+=((ans[i+j]&1)<<j);
}
res.pb(cur);
}
return res;
}
//Baijan
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
vector<pair<int,int>> adjb[2005];
int n;
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,std::vector<int> D) {
n=N;
int dis[n];
for (int i = 0; i < n; ++i)
{
dis[i]=1e9;
adjb[S[i]].pb({T[i],D[i]});
adjb[T[i]].pb({S[i],D[i]});
}
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
pq.push({0,0});
dis[0]=0;
while(!pq.empty()){
int node=pq.top().se;
int d=pq.top().fi;
pq.pop();
if(d!=dis[node]) continue;
for(auto u:adjb[node]){
int newd=d+u.se;
if(newd>dis[u.fi]) continue;
dis[u.fi]=newd;
pq.push({newd,u.fi});
}
}
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < 20; ++j)
{
if((1<<j)&dis[i]) SendB(1);
else SendB(0);
}
}
}
void ReceiveB(bool y){
}