이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Azer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
vector<pair<int,int>> adja[2005];
int n;
vector<bool> ans;
void SendA(bool y);
void InitA(int N, int A, std::vector<int> U, std::vector<int> V,std::vector<int> C){
return;
}
void ReceiveA(bool x) {
ans.pb(x);
}
std::vector<int> Answer() {
vector<int> res;
for (int i = 0; i < ans.size(); i+=20)
{
int cur=0;
for (int j = 0; j < 20; ++j)
{
cur+=((ans[i+j]&1)<<j);
}
res.pb(cur);
}
return res;
}
//Baijan
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
vector<pair<int,int>> adjb[2005];
int n;
void SendB(bool x);
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,std::vector<int> D){
n=N;
int dis[n];
for (int i = 0; i < B; ++i)
{
dis[i]=1e9;
adjb[S[i]].pb({T[i],D[i]});
adjb[T[i]].pb({S[i],D[i]});
}
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
pq.push({0,0});
dis[0]=0;
while(!pq.empty()){
int node=pq.top().se;
int d=pq.top().fi;
pq.pop();
if(d!=dis[node]) continue;
for(auto u:adjb[node]){
int newd=d+u.se;
if(newd>dis[u.fi]) continue;
dis[u.fi]=newd;
pq.push({newd,u.fi});
}
}
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < 20; ++j)
{
if((1<<j)&dis[i]) SendB(1);
else SendB(0);
}
}
}
void ReceiveB(bool y){
return;
}
컴파일 시 표준 에러 (stderr) 메시지
Azer.cpp: In function 'std::vector<int> Answer()':
Azer.cpp:24:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for (int i = 0; i < ans.size(); i+=20)
| ~~^~~~~~~~~~~~
# | 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... |