#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;
long long ans[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;
ans[cnt / 20] += (X << (cnt%20));
++cnt;
}
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];
int L[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++) {
adj[S[i]].push_back({T[i], D[i]});
adj[T[i]].push_back({S[i], D[i]});
}
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++) {
for(int j=0; j<20; j++) SendB((L[i] >> j) & 1);
}
}
void ReceiveB(bool y) {
assert(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
578 ms |
1600 KB |
Output is correct |
2 |
Correct |
4 ms |
1240 KB |
Output is correct |
3 |
Correct |
430 ms |
1600 KB |
Output is correct |
4 |
Correct |
902 ms |
20176 KB |
Output is correct |
5 |
Correct |
47 ms |
1760 KB |
Output is correct |
6 |
Correct |
780 ms |
4520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1000 KB |
Output is correct |
2 |
Incorrect |
606 ms |
1800 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
572 ms |
1520 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
1360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
1360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
1360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
578 ms |
1600 KB |
Output is correct |
2 |
Correct |
4 ms |
1240 KB |
Output is correct |
3 |
Correct |
430 ms |
1600 KB |
Output is correct |
4 |
Correct |
902 ms |
20176 KB |
Output is correct |
5 |
Correct |
47 ms |
1760 KB |
Output is correct |
6 |
Correct |
780 ms |
4520 KB |
Output is correct |
7 |
Correct |
6 ms |
1000 KB |
Output is correct |
8 |
Incorrect |
606 ms |
1800 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |