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;
namespace az {
const int MAXN = 2e3 + 10;
const int INF = 1e9 + 7;
using pii = pair<int, int>;
vector<pii> adj[MAXN];
int dist[MAXN];
bool seen[MAXN];
int n;
int count;
int cur_a, cur_b, cur_c;
void dijkstra() {
dist[0] = 0;
seen[0] = true;
for (int i = 1; i < n; i++) {
dist[i] = INF;
seen[i] = false;
}
set<pii> s;
s.insert({0, 0});
while (!s.empty()) {
auto x = s.begin();
int v = x->second;
s.erase(x);
seen[v] = true;
for (auto [w, c]: adj[v]) {
if (seen[w]) continue;
if (dist[v] + c < dist[w]) {
if (dist[w] != INF) s.erase({dist[w], w});
dist[w] = dist[v] + c;
s.insert({dist[w], w});
}
}
}
}
}
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,
std::vector<int> C) {
az::n = N;
az::count = 0;
az::cur_a = az::cur_b = az::cur_c = 0;
}
void ReceiveA(bool x) {
int cur = az::count;
if (cur % 31 <= 10) {
// first vertex
int bit = cur % 31;
if (x) az::cur_a += (1 << bit);
} else if (cur % 31 <= 21) {
int bit = cur % 31 - 11;
if (x) az::cur_b += (1 << bit);
} else {
int bit = cur % 31 - 22;
if (x) az::cur_c += (1 << bit);
}
if (cur % 31 == 30) {
az::adj[az::cur_a].push_back({az::cur_b, az::cur_c});
az::adj[az::cur_b].push_back({az::cur_a, az::cur_c});
az::cur_a = az::cur_b = az::cur_c = 0;
}
az::count++;
}
std::vector<int> Answer() {
std::vector<int> ans(az::n);
az::dijkstra();
for (int k = 0; k < az::n; ++k) {
ans[k] = az::dist[k];
}
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
namespace ba {
}
void send_vertex(int v) {
for (int i = 0; i < 11; i++) {
SendB((v & (1 << i)) ? true : false);
}
}
void send_cost(int c) {
for (int i = 0; i < 9; i++) {
SendB((c & (1 << i)) ? true : false);
}
}
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
std::vector<int> D) {
for (int i = 0; i < B; i++) {
send_vertex(S[i]);
send_vertex(T[i]);
send_cost(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... |