Submission #565026

# Submission time Handle Problem Language Result Execution time Memory
565026 2022-05-20T07:54:13 Z 1zaid1 Saveit (IOI10_saveit) C++14
50 / 100
282 ms 14760 KB
#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
1 Correct 282 ms 14760 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4872 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 107 ms 9736 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4876 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 86 ms 9948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 93 ms 10308 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 111 ms 10816 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 99 ms 10000 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 97 ms 10284 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 109 ms 10252 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 97 ms 10436 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 95 ms 10220 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 120 ms 10896 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 10260 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 91 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 115 ms 10788 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 114 ms 10812 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 117 ms 11004 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 105 ms 10572 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 130 ms 11256 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 151 ms 11412 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 10908 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 136 ms 11548 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 282 ms 14760 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4872 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 107 ms 9736 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4876 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 86 ms 9948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 93 ms 10308 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 111 ms 10816 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 99 ms 10000 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 97 ms 10284 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 109 ms 10252 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 97 ms 10436 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 95 ms 10220 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 120 ms 10896 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 10260 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 91 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 115 ms 10788 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 114 ms 10812 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 117 ms 11004 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 105 ms 10572 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 130 ms 11256 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 151 ms 11412 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 10908 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 136 ms 11548 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 282 ms 14760 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4872 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 107 ms 9736 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4876 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 86 ms 9948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 93 ms 10308 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 111 ms 10816 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 99 ms 10000 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 97 ms 10284 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 109 ms 10252 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 97 ms 10436 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 95 ms 10220 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 120 ms 10896 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 10260 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 91 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 115 ms 10788 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 114 ms 10812 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 117 ms 11004 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 105 ms 10572 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 130 ms 11256 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 151 ms 11412 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 10908 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 136 ms 11548 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 282 ms 14760 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4872 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 107 ms 9736 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4876 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 86 ms 9948 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 93 ms 10308 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 111 ms 10816 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 99 ms 10000 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 97 ms 10284 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 109 ms 10252 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 97 ms 10436 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 95 ms 10220 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 120 ms 10896 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 95 ms 10260 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 91 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 115 ms 10788 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 114 ms 10812 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 117 ms 11004 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 105 ms 10572 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 130 ms 11256 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 151 ms 11412 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 112 ms 10908 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 136 ms 11548 KB Output is partially correct - 360000 call(s) of encode_bit()