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>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
namespace {
const int MAXN = 2010;
vector<pii> adj[MAXN];
vector<int> res;
int cnt = 0, now = 0;
}
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,
std::vector<int> C) {
assert(A == 0);
}
void ReceiveA(bool x) {
now = now * 2 + x;
cnt++;
if(cnt == 20) {
res.eb(now);
cnt = 0;
now = 0;
}
}
std::vector<int> Answer() {
return res;
}
#include "Baijan.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
namespace {
const int MAXN = 2010;
vector<pii> adj[MAXN];
int dist[MAXN];
int buf[100];
}
void sendInt(int x, int len) {
For(i, 0, len - 1) {
buf[i] = (x & 1);
x /= 2;
}
Forr(i, len - 1, 0) SendB(buf[i]);
}
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
std::vector<int> D) {
For(i, 0, B - 1) {
adj[S[i]].eb(T[i], D[i]);
adj[T[i]].eb(S[i], D[i]);
}
priority_queue<pii, vector<pii>, greater<pii>> pq;
pq.emplace(0, 0);
memset(dist, -1, sizeof(dist));
while(!pq.empty()) {
int now = pq.top().second;
int d = pq.top().first;
pq.pop();
if(dist[now] != -1) continue;
dist[now] = d;
for(auto &e:adj[now]) {
if(dist[e.first] == -1) {
pq.emplace(d + e.second, e.first);
}
}
}
For(i, 0, N - 1) sendInt(dist[i], 20);
}
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... |