이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Azer.h"
#include <bits/stdc++.h>
using namespace std;
int casef=0,NN_;
vector<int>Ua,Va,Ca;
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,
std::vector<int> C) {
NN_=N;
if(!A)SendA(0);
else SendA(1);
casef=!!A;
Ua=U;
Va=V;
Ca=C;
}
vector<int>bits;
void ReceiveA(bool x) {
bits.push_back(x);
}
std::vector<int> Answer() {
if(casef) {
vector<vector<pair<int,int>>>adj(NN_);
int C=bits.size();
for(int i=0;i<C/31;i++){
int U=0,V=0,D=0;
for(int j=0;j<11;j++)
U=U*2+bits[i*31+j];
for(int j=11;j<22;j++)
V=V*2+bits[i*31+j];
for(int j=22;j<31;j++)
D=D*2+bits[i*31+j];
adj[U].push_back({V,D});
adj[V].push_back({U,D});
}
for(int i=0;i<Ua.size();i++){
adj[Ua[i]].push_back({Va[i],Ca[i]});
adj[Va[i]].push_back({Ua[i],Ca[i]});
}
vector<int>dist(NN_,1e9);
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>>pq;
dist[0]=0;
pq.push({0,0});
while(pq.size()){
auto[d,x]=pq.top();
pq.pop();
if(dist[x]<d)continue;
for(auto [v,w]:adj[x])
if(dist[v]>w+d)
pq.push({dist[v]=w+d,v});
}
return dist;
}
std::vector<int> ans(NN_);
for(int i=0;i<bits.size();i++)
ans[i/20]=ans[i/20]<<1|bits[i];
return ans;
}
#include "Baijan.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> adj[2010];
int dist[2010],N_;
vector<int>S_bai,T_bai,D_bai;
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
std::vector<int> D) {
N_=N;
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]});
S_bai=S;
T_bai=T;
D_bai=D;
}
void sendnum(int n,int b){
for(int i=b;i--;)
SendB(n>>i&1);
}
void ReceiveB(bool y) {
if(y){
for(int i=0;i<S_bai.size();i++){
sendnum(S_bai[i],11);
sendnum(T_bai[i],11);
sendnum(D_bai[i],9);
}
} else {
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>>pq;
memset(dist,7,sizeof dist);
dist[0]=0;
pq.push({0,0});
while(pq.size()){
auto[d,x]=pq.top();
pq.pop();
if(dist[x]<d)continue;
for(auto [v,w]:adj[x])
if(dist[v]>w+d)
pq.push({dist[v]=w+d,v});
}
for(int i=0;i<N_;i++)
sendnum(dist[i],20);
}
}
컴파일 시 표준 에러 (stderr) 메시지
Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | for(int i=0;i<Ua.size();i++){
| ~^~~~~~~~~~
Azer.cpp:54:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
54 | for(int i=0;i<bits.size();i++)
| ~^~~~~~~~~~~~
Baijan.cpp: In function 'void ReceiveB(bool)':
Baijan.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for(int i=0;i<S_bai.size();i++){
| ~^~~~~~~~~~~~~
# | 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... |