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;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;
namespace {
const ll MAXN = 2E3+16, INF = ll(1E18)+16;
int n;
int cou;
vll ve;
ll cur;
vector <pair <ll, ll> > adj[MAXN];
bool vis[MAXN];
vll dis;
} // namespace
void InitA (int n, int m, vi us, vi vs, vi wws) {
::n = n;
// for (ll i = 0; i < m; i++) {
// adj[us[i]].push_back({ vs[i], wws[i] });
// adj[vs[i]].push_back({ us[i], wws[i] });
// }
cou = 0;
cur = 0;
// SendA(0);
}
void ReceiveA (bool x) {
if (cou%31 < 11) {cur |= x<<cou%31;
if (cou%31 == 10) { ve.push_back(cur); cur = 0; }}
else {if (cou%31 < 11+11) {cur |= x<<(cou%31-11);
if (cou%31 == 21) { ve.push_back(cur); cur = 0; }}
else {if (cou%31 < 31) cur |= x<<(cou%31-22);
if (cou%31 == 30) {
adj[ve[0]].push_back({ ve[1], cur });
adj[ve[1]].push_back({ ve[0], cur });
ve = {};
cur = 0;
}}}
cou++;
}
vi Answer () {
dis = vll(n, INF);
priority_queue <pair <ll, ll> > pq;
dis[0] = 0;
pq.push({ -dis[0], 0 });
while (pq.size()) {
ll u = pq.top().second; pq.pop();
if (vis[u]) continue;
vis[u] = true;
for (auto [v, w] : adj[u]) {
if (dis[v] <= dis[u]+w) continue;
dis[v] = dis[u]+w;
pq.push({ -dis[v], v });
}
}
return vi(dis.begin(), dis.end());
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;
namespace {
int n;
vll dis;
void mySend (ll x, ll bits) {
for (ll i = 0; i < bits; i++) SendB(x>>i&1);
}
} // namespace
void InitB (int n, int m, vi us, vi vs, vi wws) {
::n = n;
for (ll i = 0; i < m; i++) {
mySend(us[i], 11);
mySend(vs[i], 11);
mySend(wws[i], 9);
}
}
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... |