# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
565076 | Rifal | 저장 (Saveit) (IOI10_saveit) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <fstream>
#include "grader.h"
#include "encoder.h"
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
const int M = 1005;
vector<int> v[M];
long long dist[M];
void bfs(int s)
{
dist[s] = 0;
queue<int> q;
q.push(s);
while(!q.empty())
{
int x = q.front();
q.pop();
for(auto i : v[x])
{
if(dist[i] == INF)
{
q.push(i);
dist[i] = dist[x]+1;
}
}
}
}
void encode(int n, int h, int p, int a[], int b[])
{
for(int i = 0; i < p; i++)
{
v[a[i]].push_back(b[i]);
v[b[i]].push_back(a[i]);
}
for(int i = 0; i < h; i++)
{
for(int j = 0; j < n; j++)
{
dist[j] = INF;
}
bfs(i);
for(int j = 0; j < n; j++)
{
for(int cnt = 0; cnt < dist[j]; cnt++)
{
encode_bit(1);
}
encode_bit(0);
}
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
void decoder(int n, int h)
{
for(int i = 0; i < h; i++)
{
for(int j = 0; j < n; j++)
{
long long cnt = 0;
while(decode_bit() != 0)
{
cnt++;
}
hops(i,j,cnt);
}
}
}