이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
const int M = 1e4+5;
vector<vector<int>> node(M, vector<int>({}));
vector<int> vis(M, 0), dist(M, 0);
void bfs(int s) {
queue<int> q;
q.push(s);
vis[s] = true;
while (!q.empty()) {
int f = q.front(); q.pop();
for (int i:node[f]) {
if (!vis[i]) {
vis[i] = true;
dist[i] = dist[f]+1;
q.push(i);
}
}
}
}
void encode(int n, int h, int p, int *a, int *b){
for (int i = 0; i < p; i++) {
node[a[i]].push_back(b[i]);
node[b[i]].push_back(a[i]);
}
map<pair<int, int>, int> ans;
for (int i = 0; i < h; i++) {
for (int j = 0; j < n; j++) dist[j] = vis[j] = 0;
bfs(i);
for (int j = 0; j < n; j++) ans[{i, j}] = dist[j];
}
for (int i = 0; i < h; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < 10; k++) {
encode_bit((ans[{i, j}]&(1<<k))!=0);
}
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
using namespace std;
void decode(int n, int h) {
vector<vector<int>> pp(h, vector<int>(n, 0));
for (int i = 0; i < h; i++) {
for (int j = 0; j < n; j++) {
for (int k = 0; k < 10; k++) {
pp[i][j] += decode_bit()*(1<<k);
}
}
}
for (int i = 0; i < h; i++) {
for (int j = 0; j < n; j++) {
hops(i, j, pp[i][j]);
}
}
}
# | 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... |