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;
int n, a;
vector<int> u, v, c;
void InitA(int N, int A, vector<int> U, vector<int> V, vector<int> C){
n = N;
a = A;
u = U;
v = V;
c = C;
}
vector<int> res;
int cnt = 0, cur = 0;
void ReceiveA(bool x){
cnt = 2*cnt + x;
cur++;
if (cur >= 18){
res.push_back(cnt);
cnt = 0;
cur = 0;
}
}
vector<int> Answer(){
return res;
}
#include <Baijan.h>
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define SZ(x) (int)((x).size())
int n, b;
vector<int> s, t, d;
void InitB(int N, int B, vector<int> S, vector<int> T, vector<int> D){
n = N;
b = B;
s = S;
t = T;
d = D;
// dij
vector<pii> g[N];
vector<int> dis(N);
fill(ALL(dis), 100000000);
REP(i, B){
g[S[i]].pb({T[i], D[i]});
g[T[i]].pb({S[i], D[i]});
}
priority_queue<pii, vector<pii>, greater<pii> > pq;
pq.push({0, 0});
while(pq.size()){
pii tp = pq.top(); pq.pop();
if (dis[tp.s] < 100000000) continue;
dis[tp.s] = tp.f;
for(pii x:g[tp.s]){
pq.push({x.s+tp.f, x.f});
}
}
for (int i = 0; i < N; i++){
vector<bool> f;
while(dis[i] > 0){
if (dis[i]&1) f.pb(1);
else f.pb(0);
dis[i]>>=1;
}
while(SZ(f) < 18) f.pb(0);
reverse(ALL(f));
REP(j, 18) SendB(f[j]);
}
}
void ReceiveB(bool y){
return;
}
/*signed main(){
InitB(4, 4, {1,3,3,3}, {2,1,2,0}, {3,1,3,7});
}
*/
# | 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... |