제출 #583245

#제출 시각아이디문제언어결과실행 시간메모리
583245Jomnoi저장 (Saveit) (IOI10_saveit)C++17
0 / 100
252 ms12616 KiB
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;

const int MAX_N = 1000;

vector <int> graph[MAX_N];
int dist[MAX_N][MAX_N];

void encode(int nv, int nh, int ne, int *v1, int *v2) {
    for(int i = 0; i < ne; i++) {
        graph[v1[i]].push_back(v2[i]);
        graph[v2[i]].push_back(v1[i]);
    }

    for(int i = 0; i < nh; i++) {
        for(int j = 0; j < nv; j++) {
            dist[i][j] = -1;
        }

        queue <int> q;
        dist[i][i] = 0;
        q.push(i);
        while(!q.empty()) {
            int u = q.front();
            q.pop();

            for(auto v : graph[u]) {
                if(dist[i][v] == -1) {
                    dist[i][v] = dist[i][u] + 1;
                    q.push(v);
                }
            }
        }
    }

    for(int i = 0; i < nh; i++) {
        for(int j = 0; j < nv; j++) {
            for(int k = 0; k < 10; k++) {
                if((1<<k) & dist[i][j]) {
                    encode_bit(1);
                }
                else {
                    encode_bit(0);
                }
            }
        }
    }
}
#include <bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;

void decode(int nv, int nh) {
    for(int i = 0; i < nh; i++) {
        for(int j = 0; j < nv; j++) {
            int sum = 0;
            for(int k = 0; k < 10; k++) {
                sum += (1<<k) * decode_bit();
            }

            cout << i << ' ' << j << " : " << sum << endl;
            hops(i, j, sum);
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...