이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int n;
vector<int> ans;
int bit = 0;
int b = -1;
int tmp = 0;
const int MAXN = 2001;
const int INF = 1e9;
vector<pair<int, int>> adj[MAXN];
tuple<int, int, int> decode_edge(int val) {
int u = 0, v = 0, w = 0;
for (int i=0; i<11; i++) {
if (((1 << i) & val) != 0) u += (1 << i);
}
val >>= 11;
for (int i=0; i<11; i++) {
if (((1 << i) & val) != 0) v += (1 << i);
}
val >>= 11;
for (int i=0; i<10; i++) {
if (((1 << i) & val) != 0) w += (1 << i);
}
return {u, v, w};
}
} // namespace
void InitA(int N, int A, vector<int> U, vector<int> V,
vector<int> C) {
n = N;
ans = vector<int> (n, 1e9);
// SendA(true);
for (int i=0; i<A; i++) {
int u = U[i], v = V[i], w = C[i];
adj[u].push_back({v, w});
adj[v].push_back({u, w});
}
}
void ReceiveA(bool x) {
if (x) {
tmp += (1 << bit);
}
bit++;
if (b == -1) {
if (bit == 30) {
bit = 0;
b = tmp;
tmp = 0;
}
} else {
if (bit == 32) {
auto [u, v, w] = decode_edge(tmp);
cerr << "receive: " << u << ' ' << v << ' ' << w << endl;
adj[u].push_back({v, w});
adj[v].push_back({u, w});
bit = 0;
b--;
tmp = 0;
}
}
if (b == 0) {
ans[0] = 0;
priority_queue<
pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>
> pq;
pq.push({0, 0});
while (!pq.empty()) {
int v = pq.top().second, d = pq.top().first;
pq.pop();
if (ans[v] < d) continue;
for (auto [viz, w] : adj[v]) {
if (ans[viz] > d + w) {
ans[viz] = d + w;
pq.push({d + w, viz});
}
}
}
}
}
vector<int> Answer() {
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
} // namespace
void InitB(int N, int B, vector<int> S, vector<int> T,
vector<int> D) {
for (int b=0; b<30; b++) {
if (((1 << b) & B) != 0) SendB(true);
else SendB(false);
}
for (int i=0; i<B; i++) {
int u = S[i], v = T[i], w = D[i];
cerr << "send: " << u << ' ' << v << ' ' << w << endl;
for (int b=0; b<11; b++) {
if (((1 << b) & u) != 0) SendB(true);
else SendB(false);
}
for (int b=0; b<11; b++) {
if (((1 << b) & v) != 0) SendB(true);
else SendB(false);
}
for (int b=0; b<10; b++) {
if (((1 << b) & w) != 0) SendB(true);
else SendB(false);
}
}
}
void ReceiveB(bool y) {
// ++count;
// if (count < 58000) {
// SendB(FunctionExample(y));
// ++count;
// }
}
# | 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... |