이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2000;
const int MAXA = 6e5;
const int INF = 1e9;
struct Edge
{
int u, v, w;
};
static int N, A, B;
static Edge EA[MAXA+10], EB[MAXA+10];
static int ans[MAXN+10];
static vector<pii> adj[MAXN+10];
static int cnt=0;
static int par[MAXN+10], len[MAXN+10];
struct Queue
{
int u, w;
bool operator < (const Queue &p) const
{
return w>p.w;
}
};
static int dist[MAXN+10];
vector<int> Answer()
{
vector<int> ret=vector<int>(ans, ans+N);
return ret;
}
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++) EA[i]={_U[i], _V[i], _C[i]};
}
void dijk()
{
//printf("B : %d\n", B);
for(int i=0; i<A; i++)
{
int u=EA[i].u, v=EA[i].v, w=EA[i].w;
assert(u!=v); assert(w<=500);
adj[u].push_back({v, w});
adj[v].push_back({u, w});
}
for(int i=0; i<N; i++)
{
int u=par[i], v=i, w=len[i];
if(u==v) continue;
assert(u!=v); assert(w<=500);
adj[u].push_back({v, w});
adj[v].push_back({u, w});
}
for(int i=0; i<N; i++) dist[i]=INF;
priority_queue<Queue> PQ;
PQ.push({0, 0});
while(!PQ.empty())
{
Queue now=PQ.top(); PQ.pop();
if(dist[now.u]<=now.w) continue;
//printf("%d %d\n", now.u, now.w);
dist[now.u]=now.w;
for(auto nxt : adj[now.u]) PQ.push({nxt.first, nxt.second+now.w});
}
for(int i=0; i<N; i++) ans[i]=dist[i];
}
void ReceiveA(bool x)
{
if(x)
{
int t=cnt%20;
if(t<11) par[cnt/20]|=(1<<t);
else len[cnt/20]|=(1<<(t-11));
}
if(cnt==N*20-1) dijk();
cnt++;
}
#include "Baijan.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2000;
const int MAXA = 5e5;
const int INF = 1e9;
struct Edge
{
int u, v, w;
};
static int N, B;
static Edge EA[MAXA+10], EB[MAXA+10];
static int ans[MAXN+10];
static vector<pii> adj[MAXN+10];
static int cnt=0;
static int par[MAXN+10], len[MAXN+10];
static bool vis[MAXN+10];
void dfs(int now, int bef)
{
par[now]=bef;
vis[now]=true;
for(auto nxt : adj[now])
{
if(nxt.first==bef) continue;
len[nxt.first]=nxt.second;
dfs(nxt.first, now);
}
}
void InitB(int _N, int _B, vector<int> _U, vector<int> _V, vector<int> _C)
{
N=_N; B=_B;
for(int i=0; i<B; i++) EB[i]={_U[i], _V[i], _C[i]};
for(int i=0; i<B; i++)
{
int u=EB[i].u, v=EB[i].v, w=EB[i].w;
adj[u].push_back({v, w});
adj[v].push_back({u, w});
}
for(int i=0; i<N; i++)
{
if(vis[i]) continue;
dfs(i, i);
}
for(int i=0; i<N; i++)
{
for(int j=0; j<11; j++)
{
if(par[i]&(1<<j)) SendB(1);
else SendB(0);
}
for(int j=0; j<9; j++)
{
if(len[i]&(1<<j)) SendB(1);
else SendB(0);
}
}
}
void ReceiveB(bool x)
{
}
컴파일 시 표준 에러 (stderr) 메시지
Azer.cpp:19:26: warning: 'EB' defined but not used [-Wunused-variable]
19 | static Edge EA[MAXA+10], EB[MAXA+10];
| ^~
Azer.cpp:18:18: warning: 'B' defined but not used [-Wunused-variable]
18 | static int N, A, B;
| ^
Baijan.cpp:22:12: warning: 'cnt' defined but not used [-Wunused-variable]
22 | static int cnt=0;
| ^~~
Baijan.cpp:20:12: warning: 'ans' defined but not used [-Wunused-variable]
20 | static int ans[MAXN+10];
| ^~~
Baijan.cpp:19:13: warning: 'EA' defined but not used [-Wunused-variable]
19 | static Edge EA[MAXA+10], EB[MAXA+10];
| ^~
# | 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... |