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 {
int n;
int cou;
vll dis;
} // namespace
void InitA (int n, int m, vi us, vi vs, vi wws) {
::n = n;
cou = 0;
dis = vll(n, 0);
}
void ReceiveA (bool x) {
dis[cou/20] |= x<<(cou%20);
cou++;
}
vi Answer () {
vi ans(dis.begin(), dis.end());
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using vi = vector <int>;
const ll MAXN = 2E3+16, INF = ll(1E18)+16;
namespace {
int n;
vll dis;
vector <pair <ll, ll> > adj[MAXN];
bool vis[MAXN];
void mySend (ll x) {
for (ll i = 0; i < 20; 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++) {
adj[us[i]].push_back({ vs[i], wws[i] });
adj[vs[i]].push_back({ us[i], wws[i] });
}
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 });
}
}
for (ll i : dis) {
mySend(i);
}
}
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... |