이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Azer.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
namespace {
const int MAXN = 2010;
vector<pii> adj[MAXN];
int dist[MAXN];
int N;
int B;
int a, b;
int fi = 1;
int bit_cnt = 0, now = 0;
int ed = 0, tot_ed = 0;
}
void InitA(int _N, int A, std::vector<int> U, std::vector<int> V,
std::vector<int> C) {
N = _N;
For(i, 0, A - 1) {
adj[U[i]].eb(V[i], C[i]);
adj[V[i]].eb(U[i], C[i]);
}
}
void reset() {
bit_cnt = now = 0;
}
void ReceiveA(bool x) {
now = now * 2 + x;
bit_cnt++;
if(bit_cnt == 10 && fi) {
B = now;
fi = 0;
reset();
} else if(bit_cnt == 20 && ed == 0) {
ed++;
a = now;
reset();
} else if(bit_cnt == 20 && ed == 1) {
ed++;
b = now;
reset();
} else if(bit_cnt == 10 && ed == 2) {
ed = 0;
adj[a].eb(b, now);
adj[b].eb(a, now);
reset();
}
}
std::vector<int> Answer() {
priority_queue<pii, vector<pii>, greater<pii>> pq;
pq.emplace(0, 0);
memset(dist, -1, sizeof(dist));
while(!pq.empty()) {
int now = pq.top().second;
int d = pq.top().first;
pq.pop();
if(dist[now] != -1) continue;
dist[now] = d;
for(auto &e:adj[now]) {
if(dist[e.first] == -1) {
pq.emplace(d + e.second, e.first);
}
}
}
vector<int> res;
For(i, 0, N - 1) res.eb(dist[i]);
return res;
}
#include "Baijan.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
namespace {
const int MAXN = 2010;
vector<pii> adj[MAXN];
int dist[MAXN];
int buf[100];
}
void sendInt(int x, int len) {
For(i, 0, len - 1) {
buf[i] = (x & 1);
x /= 2;
}
Forr(i, len - 1, 0) SendB(buf[i]);
}
void InitB(int N, int B, std::vector<int> S, std::vector<int> T,
std::vector<int> D) {
assert(B <= 1000);
sendInt(B, 10);
For(i, 0, B - 1) {
sendInt(S[i], 20);
sendInt(T[i], 20);
sendInt(D[i], 10);
// adj[S[i]].eb(T[i], D[i]);
// adj[T[i]].eb(S[i], D[i]);
}
// priority_queue<pii, vector<pii>, greater<pii>> pq;
// pq.emplace(0, 0);
// memset(dist, -1, sizeof(dist));
// while(!pq.empty()) {
// int now = pq.top().second;
// int d = pq.top().first;
// pq.pop();
// if(dist[now] != -1) continue;
// dist[now] = d;
// for(auto &e:adj[now]) {
// if(dist[e.first] == -1) {
// pq.emplace(d + e.second, e.first);
// }
// }
// }
// For(i, 0, N - 1) sendInt(dist[i], 20);
}
void ReceiveB(bool y) {
}
컴파일 시 표준 에러 (stderr) 메시지
Azer.cpp:25:13: warning: '{anonymous}::tot_ed' defined but not used [-Wunused-variable]
25 | int ed = 0, tot_ed = 0;
| ^~~~~~
Baijan.cpp:18:5: warning: '{anonymous}::dist' defined but not used [-Wunused-variable]
18 | int dist[MAXN];
| ^~~~
# | 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... |