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;
vector<int> tt;
int cnt, rr, last;
void InitA(int n, int a, vector<int> u, vector<int> v, vector<int> c) {
//~ assert(!a);
tt.resize(n);
cnt = 0, rr = 0, last = 1;
}
void ReceiveA(bool x) {
cnt++, rr <<= 1; rr |= x;
//~ cout<<x<<" ";
if(cnt == 20) tt[last] = rr, cnt = rr = 0, last++;
}
vector<int> Answer() {
//~ for(int i=0;i<(int)tt.size();i++) cout<<tt[i]<<" ";
//~ cout<<"\n";
return tt;
}
#include "Baijan.h"
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
const int N = 2e3+5;
vector<pair<int, int>> edges[N];
vector<int> dd(N, 1e9+7);
void InitB(int n, int b, vector<int> s, vector<int> t, vector<int> d) {
for(int i=0;i<(int)s.size();i++){
int a = s[i], b = t[i], c = d[i];
edges[a].push_back({b, c}), edges[b].push_back({a, c});
}
priority_queue<pair<int, int>> qq;
qq.push({0, 0}), dd[0] = 0;
while(!qq.empty()){
auto u = qq.top(); qq.pop();
if(dd[u.ss] < -u.ff) continue;
for(auto x : edges[u.ss]){
if(dd[x.ff] > dd[u.ss] + x.ss) dd[x.ff] = dd[u.ss] + x.ss, qq.push({-dd[x.ff], x.ff});
}
}
//~ for(int i=0;i<n;i++) cout<<dd[i]<<" ";
//~ cout<<"\n";
//~ for(int i=1;i<n;i++){
//~ for(int j=19;j>=0;j--) cout<<(dd[i]>>j&1)<<" ";
//~ cout<<"\n";
//~ }
for(int i=1;i<n;i++){
for(int j=19;j>=0;j--) SendB(dd[i]>>j&1);
}
}
/*
4 0 7
0 1 6
2 1 4
2 0 10
1 2 3
3 1 1
3 2 3
3 0 7
*/
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... |