답안 #894907

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
894907 2023-12-29T07:52:56 Z sleepntsheep 저장 (Saveit) (IOI10_saveit) C++17
50 / 100
190 ms 20868 KB
#include "grader.h"
#include "encoder.h"
#include <vector>
#include <queue>


void send_int(int x, int nb)
{
    for (int j = 0; j < nb; ++j) encode_bit((x >> j) & 1);
}

#define N 1001

using namespace std;

vector<int> g[N];
int n, h;

vector<int> bfs(int u)
{
    vector<int> d(n, 1e9);
    queue<pair<int, int>> q;
    q.emplace(d[u] = 0, u);
    while (q.size())
    {
        auto [c, u] = q.front(); q.pop();
        for (auto v : g[u])
        {
            if (c + 1 < d[v])
                q.emplace(d[v] = c + 1, v);
        }
    }
    return d;
}

void encode(int n0, int h0, int ne, int *v1, int *v2){
    for (int i = 0; i < ne; ++i) g[v1[i]].push_back(v2[i]), g[v2[i]].push_back(v1[i]);
    ::n = n0; ::h = h0;

    for (int i = 0; i < h; ++i)
    {
        auto d = bfs(i);
        for (int j = 0; j < n; ++j)
            send_int(d[j], 10);
    }

    return;
}

#include "grader.h"
#include "decoder.h"

unsigned read_int(int nb)
{
    unsigned u = 0;
    for (int j = 0; j < nb; ++j) u |= decode_bit() << j;
    return u;
}

int n, h;

void decode(int v0, int h0) {
    ::n = v0; ::h = h0;
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            hops(i, j, read_int(10));
        }
    }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 20868 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 12032 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 46 ms 12256 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 12036 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 48 ms 12704 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 63 ms 14836 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 71 ms 14736 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 59 ms 14436 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 53 ms 14448 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 60 ms 14288 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 61 ms 14476 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 51 ms 14480 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 65 ms 15288 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 56 ms 14292 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 54 ms 14468 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 66 ms 14716 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 62 ms 14688 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 67 ms 15412 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 60 ms 14536 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 74 ms 15304 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 87 ms 15208 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 75 ms 14832 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 87 ms 15544 KB Output is partially correct - 360000 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 20868 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 12032 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 46 ms 12256 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 12036 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 48 ms 12704 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 63 ms 14836 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 71 ms 14736 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 59 ms 14436 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 53 ms 14448 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 60 ms 14288 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 61 ms 14476 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 51 ms 14480 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 65 ms 15288 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 56 ms 14292 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 54 ms 14468 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 66 ms 14716 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 62 ms 14688 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 67 ms 15412 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 60 ms 14536 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 74 ms 15304 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 87 ms 15208 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 75 ms 14832 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 87 ms 15544 KB Output is partially correct - 360000 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 20868 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 12032 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 46 ms 12256 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 12036 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 48 ms 12704 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 63 ms 14836 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 71 ms 14736 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 59 ms 14436 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 53 ms 14448 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 60 ms 14288 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 61 ms 14476 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 51 ms 14480 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 65 ms 15288 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 56 ms 14292 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 54 ms 14468 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 66 ms 14716 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 62 ms 14688 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 67 ms 15412 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 60 ms 14536 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 74 ms 15304 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 87 ms 15208 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 75 ms 14832 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 87 ms 15544 KB Output is partially correct - 360000 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 190 ms 20868 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 2 ms 12032 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 46 ms 12256 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 2 ms 12036 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 48 ms 12704 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 63 ms 14836 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 71 ms 14736 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 59 ms 14436 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 53 ms 14448 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 60 ms 14288 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 61 ms 14476 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 51 ms 14480 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 65 ms 15288 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 56 ms 14292 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 54 ms 14468 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 66 ms 14716 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 62 ms 14688 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 67 ms 15412 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 60 ms 14536 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 74 ms 15304 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 87 ms 15208 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 75 ms 14832 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 87 ms 15544 KB Output is partially correct - 360000 call(s) of encode_bit()