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;
#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, a;
vector<int> u, v, c;
vector<pii> g[2005];
vector<int> dis(2005);
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;
REP(i, a){
g[u[i]].pb({v[i], c[i]});
g[v[i]].pb({u[i], c[i]});
}
}
vector<int> res;
int cnt = 0, cur = 0, typ = 1;
int ca, cb;
void ReceiveA(bool x){
cnt = 2*cnt + x;
cur++;
if (cur >= 12){
if (typ == 1){
ca = cnt;
typ = 2;
}
else if (typ == 2){
cb = cnt;
typ = 3;
}
else {
g[ca].pb({cb, cnt});
g[cb].pb({ca, cnt});
typ = 1;
}
cnt = 0;
cur = 0;
}
}
vector<int> Answer(){
fill(ALL(dis), 100000000);
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});
}
}
vector<int> res;
REP(i, n) res.pb(dis[i]);
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 snd(int a){
vector<bool> f;
while(a > 0){
f.pb(a&1);
a >>= 1;
}
while(SZ(f) < 12) f.pb(0);
reverse(ALL(f));
REP(i, 12){
SendB(f[i]);
}
}
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;
for (int i = 0; i < b; i++){
snd(s[i]);
snd(t[i]);
snd(d[i]);
}
}
void ReceiveB(bool y){
return;
}
# | 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... |