#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
namespace {
int N, A;
vector<pii> adj[2009];
int cnt = 0, u = 0, v = 0, c = 0;
long long ans[2009], L[2009];
} // namespace
void InitA(int N, int A, vector<int> U, vector<int> V, vector<int> C) {
::N = N; ::A = A;
for(int i=0; i<A; i++) {
adj[U[i]].push_back({V[i], C[i]});
adj[V[i]].push_back({U[i], C[i]});
}
}
void ReceiveA(bool x) {
int X = x;
if(cnt % 31 < 11) u += (X << (cnt%31));
else if(cnt % 31 < 22) v += (X << (cnt%31 - 11));
else if(cnt % 31 < 31) c += (X << (cnt%31 - 22));
++cnt;
if(cnt % 31 == 0) {
adj[u].push_back({v, c});
adj[v].push_back({u, c});
}
if(cnt == 31000) {
for(int i=1; i<N; i++) L[i] = 1e9;
priority_queue<pii> pq; pq.push({0, 0});
while(pq.size()) {
int c, n; tie(c, n) = pq.top(); c *= -1; pq.pop();
if(L[n] != c) continue;
for(auto& it: adj[n]) {
int u, w; tie(u, w) = it;
if(L[u] > L[n] + w) {
L[u] = L[n] + w;
pq.push({-L[u], u});
}
}
}
for(int i=0; i<N; i++) ans[i] = L[i];
}
}
vector<int> Answer() {
vector<int> S(N);
for(int i=0; i<N; i++) S[i] = ans[i];
return S;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
namespace {
int N, B;
vector<pii> adj[2009];
} // namespace
void InitB(int N, int B, vector<int> S, vector<int> T, vector<int> D) {
::N = N; ::B = B;
for(int i=0; i<B; i++) {
for(int j=0; j<11; j++) SendB((S[i] >> j) & 1);
for(int j=0; j<11; j++) SendB((T[i] >> j) & 1);
for(int j=0; j<9; j++) SendB((D[i] >> j) & 1);
}
for(int i=B; i<1000; i++) for(int j=0; j<31; j++) SendB(0);
return;
}
void ReceiveB(bool y) {
assert(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
720 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
474 ms |
1416 KB |
Output is correct |
2 |
Runtime error |
9 ms |
1268 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
9 ms |
952 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
784 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
784 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
784 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
720 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |