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;
int n;
int dist[MAXN];
int count;
}
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,
std::vector<int> C) {
az::n = N;
az::count = 0;
for (int i = 0; i < N; i++) {
az::dist[i] = 0;
}
}
void ReceiveA(bool x) {
int bit = (az::count) % 20;
int v = (az::count) / 20;
if (x) {
az::dist[v] += (1 << bit);
}
az::count++;
}
std::vector<int> Answer() {
std::vector<int> ans(az::n);
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 {
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;
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 InitB(int N, int B, std::vector<int> S, std::vector<int> T,
std::vector<int> D) {
ba::n = N;
for (int i = 0; i < B; i++) {
ba::adj[S[i]].push_back({T[i], D[i]});
ba::adj[T[i]].push_back({S[i], D[i]});
}
ba::dijkstra();
for (int v = 0; v < N; v++) {
for (int i = 0; i < 20; i++) {
SendB((ba::dist[v] & (1 << i)) ? true : false);
}
}
}
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... |