#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 |
1 |
Correct |
320 ms |
916 KB |
Output is correct |
2 |
Correct |
1 ms |
656 KB |
Output is correct |
3 |
Correct |
310 ms |
792 KB |
Output is correct |
4 |
Correct |
332 ms |
10388 KB |
Output is correct |
5 |
Correct |
20 ms |
912 KB |
Output is correct |
6 |
Correct |
334 ms |
2896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
656 KB |
Output is correct |
2 |
Runtime error |
1 ms |
584 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
584 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
320 ms |
916 KB |
Output is correct |
2 |
Correct |
1 ms |
656 KB |
Output is correct |
3 |
Correct |
310 ms |
792 KB |
Output is correct |
4 |
Correct |
332 ms |
10388 KB |
Output is correct |
5 |
Correct |
20 ms |
912 KB |
Output is correct |
6 |
Correct |
334 ms |
2896 KB |
Output is correct |
7 |
Correct |
1 ms |
656 KB |
Output is correct |
8 |
Runtime error |
1 ms |
584 KB |
Execution killed with signal 6 |
9 |
Halted |
0 ms |
0 KB |
- |