# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
201967 | Leonardo_Paes | Saveit (IOI10_saveit) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "encoder.h"
#include "grader.h"
using namespace std;
vector <int> grafo[1100];
int dist[1100][1100];
void encode(int n, int h, int p, int *v1, int *v2){
for(int i=0; i<n; i++) grafo[i].clear();
for(int i=0; i<h; i++){
grafo[v1[i]].push_back(v2[i]);
grafo[v2[i]].push_back(v1[i]);
}
for(int i=0; i<h; i++){
for(int j=0; j<n; j++){
dist[i][j] = 0x3f3f3f3f;
}
queue<int> q;
q.push(i);
dist[i][i] = 0;
while(!q.empty()){
int u = q.front();
q.pop();
for(auto v : grafo[u]){
if (dist[i][u] + 1 < dist[i][v]){
dist[i][v] = dist[i][u] + 1;
q.push(v);
}
}
}
}
for(int i=0; i<h; i++){
for(int j=0; j<n; j++){
for(int k=0; k<10; k++){
encode_bit(dist[i][j]&(1<<k));
}
}
}
return;
}