이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) u|=(1<<xd)*x;
else if(xd<22) v|=(1<<(xd-11))*x;
else c|=(1<<(xd-22))*x;
xd++;
if(xd==31){
adj[u].pb({v,c}),adj[v].pb({u,c});
xd = u = v = c = 0;
}
}
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];
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 InitB(int N, int B, vi U, vi V, vi C) {
n = N; fill(dis,dis+mxN,0);
for (int i = 0; i < B; ++i) {
adj[U[i]].pb({V[i],C[i]});
adj[V[i]].pb({U[i],C[i]});
Send(U[i],11), Send(V[i],11), Send(C[i],9);
}
}
void ReceiveB(bool y) {
}
컴파일 시 표준 에러 (stderr) 메시지
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(){
| ^~~~~~~~
# | 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... |