#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
using ar = array<int,2>;
using vi = vector<int>;
#define pb push_back
namespace {
const int mxN = (int)2e3+10;
int n,dis[mxN];
vector<ar> adj[mxN];
void dijkstra(){
priority_queue<ar,vector<ar>,greater<ar>> pq;
memset(dis,63,sizeof(dis));
pq.push({0,0}); dis[0]=0;
while(!pq.empty()){
auto [D,a] = pq.top(); pq.pop();
if(D!=dis[a]) continue;
for(auto [b,w] : adj[a])
if(dis[b]>dis[a]+w)
dis[b]=dis[a]+w,pq.push({dis[b],b});
}
}
void Send(int x, int sz){
for(int i = 0; i < sz; i++)
SendA((x>>i)&1);
}
}
void InitA(int N, int A, vi U, vi V, vi C) {
n = N; fill(dis,dis+mxN,0);
for (int i = 0; i < A; ++i) {
adj[U[i]].pb({V[i],C[i]});
adj[V[i]].pb({U[i],C[i]});
}
}
int u=0, v=0, c=0, xd=0;
void ReceiveA(bool x) {
if(xd<11) v|=(1<<xd)*x;
else c|=(1<<(xd-11))*x;
xd++;
if(xd==20){
if(v!=(1<<11)-1) adj[u].pb({v,c}),adj[v].pb({u,c});
xd = v = c = 0; u++;
}
}
vi Answer() {
dijkstra();
vi ans(n,0);
for(int k = 1; k < n; ++k)
ans[k] = dis[k];
return ans;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
using ar = array<int,2>;
using vi = vector<int>;
#define pb push_back
namespace {
const int mxN = (int)2e3+10;
int n,dis[mxN],par[mxN],W[mxN];
vector<ar> adj[mxN];
void dijkstra(){
priority_queue<ar,vector<ar>,greater<ar>> pq;
memset(dis,63,sizeof(dis));
pq.push({0,0}); dis[0]=0;
while(!pq.empty()){
auto [D,a] = pq.top(); pq.pop();
if(D!=dis[a]) continue;
for(auto [b,w] : adj[a])
if(dis[b]>dis[a]+w)
dis[b]=dis[a]+w,pq.push({dis[b],b});
}
}
void Send(int x, int sz){
for(int i = 0; i < sz; i++)
SendB((x>>i)&1);
}
void dfs(int s, int p){
for(auto [u,w] : adj[s]){
if(u!=p) par[u]=s,W[u]=w, dfs(u,s);
}
}
}
void InitB(int N, int B, vi U, vi V, vi C) {
n = N; fill(dis,dis+mxN,0);
fill(par,par+mxN,-1);
for (int i = 0; i < B; ++i) {
adj[U[i]].pb({V[i],C[i]});
adj[V[i]].pb({U[i],C[i]});
}
for(int i = 0; i < n; i++)
if(par[i]==-1) dfs(i,-1);
for(int i = 0; i < n; i++){
if(par[i]==-1) Send((1<<11)-1,11),Send(0,9);
else Send(par[i],11),Send(W[i],9);
}
}
void ReceiveB(bool y) {
}
Compilation message
Azer.cpp:24:7: warning: 'void {anonymous}::Send(int, int)' defined but not used [-Wunused-function]
24 | void Send(int x, int sz){
| ^~~~
Baijan.cpp:12:7: warning: 'void {anonymous}::dijkstra()' defined but not used [-Wunused-function]
12 | void dijkstra(){
| ^~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
1096 KB |
Output is correct |
2 |
Correct |
2 ms |
656 KB |
Output is correct |
3 |
Failed |
1 ms |
336 KB |
Unexpected end of file - int32 expected (Baijan) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
656 KB |
Output is correct |
2 |
Correct |
128 ms |
864 KB |
Output is correct |
3 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
248 ms |
876 KB |
Output is correct |
2 |
Correct |
0 ms |
656 KB |
Output is correct |
3 |
Correct |
215 ms |
988 KB |
Output is correct |
4 |
Correct |
212 ms |
872 KB |
Output is correct |
5 |
Correct |
232 ms |
868 KB |
Output is correct |
6 |
Correct |
169 ms |
868 KB |
Output is correct |
7 |
Correct |
258 ms |
740 KB |
Output is correct |
8 |
Correct |
204 ms |
908 KB |
Output is correct |
9 |
Correct |
260 ms |
892 KB |
Output is correct |
10 |
Correct |
237 ms |
992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
111 ms |
692 KB |
Output is correct |
2 |
Correct |
84 ms |
684 KB |
Output is correct |
3 |
Runtime error |
33 ms |
6592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
111 ms |
692 KB |
Output is correct |
2 |
Correct |
84 ms |
684 KB |
Output is correct |
3 |
Runtime error |
33 ms |
6592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
111 ms |
692 KB |
Output is correct |
2 |
Correct |
84 ms |
684 KB |
Output is correct |
3 |
Runtime error |
33 ms |
6592 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
1096 KB |
Output is correct |
2 |
Correct |
2 ms |
656 KB |
Output is correct |
3 |
Failed |
1 ms |
336 KB |
Unexpected end of file - int32 expected (Baijan) |
4 |
Halted |
0 ms |
0 KB |
- |