This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=2010;
int fare[maxn], cnt, m;
void InitA(int N, int A, vector<int> U, vector<int> V,vector<int> C){
m=N;
if((cnt/22)>=N) Answer();
}
void ReceiveA(bool x) {
int id=(cnt/22);
int k=(cnt%22);
if(x) fare[id]+=(1<<k);
cnt++;
}
vector<int> Answer() {
vector<int> ans(m);
for(int i=0;i<m;i++) ans[i]=fare[i];
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=2010;
const int inf=1e9+7;
vector<pair<int,int>>v[maxn];
int dist[maxn], n;
void dijkstra(){
for(int i=1;i<n;i++) dist[i]=inf;
set<pair<int,int>>s;
for(int i=0;i<n;i++) s.insert({dist[i],i});
while(!s.empty()){
auto f=s.begin();
int u=f->second; s.erase(f);
for(auto p : v[u]){
int viz=p.first, peso=p.second;
if(dist[u]+peso<dist[viz]){
s.erase({dist[viz],viz});
dist[viz]=dist[u]+peso;
s.insert({dist[viz],viz});
}
}
}
}
void InitB(int N, int B, vector<int> S, vector<int> T,vector<int> D){
n=N;
for(int i=0;i<n;i++){
v[S[i]].push_back({T[i],D[i]});
v[T[i]].push_back({S[i],D[i]});
}
dijkstra();
for(int i=0;i<n;i++){
for(int k=0;k<22;k++){
if(dist[i]&(1<<k)) SendB(1);
else SendB(0);
}
}
}
void ReceiveB(bool y) {
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |