Submission #565021

# Submission time Handle Problem Language Result Execution time Memory
565021 2022-05-20T07:50:21 Z 1zaid1 Saveit (IOI10_saveit) C++14
0 / 100
268 ms 14700 KB
#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
const int M = 1e4+5;
vector<int> node[M];
int vis[M], dist[M];

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 < 36; i++) {
        bfs(i);
        for (int j = 0; j < n; j++) ans[{i, j}] = dist[j];
        for (int j = 0; j < n; j++) dist[j] = vis[j] = 0;
    }

    for (int i = 0; i < 36; 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 < 36; 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 < 36; i++) {
        for (int j = 0; j < n; j++) {
            hops(i, j, pp[i][j]);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 268 ms 14700 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 9000 KB Execution killed with signal 11
3 Correct 92 ms 9732 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 9 ms 8968 KB Execution killed with signal 11
5 Correct 86 ms 9768 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 110 ms 10304 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 152 ms 10540 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 10024 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 107 ms 10256 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 10160 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 104 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 133 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 128 ms 10796 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 98 ms 10128 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 97 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 125 ms 10724 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 126 ms 10820 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10944 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 132 ms 10404 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 11224 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 11296 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 10824 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 177 ms 11516 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 268 ms 14700 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 9000 KB Execution killed with signal 11
3 Correct 92 ms 9732 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 9 ms 8968 KB Execution killed with signal 11
5 Correct 86 ms 9768 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 110 ms 10304 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 152 ms 10540 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 10024 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 107 ms 10256 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 10160 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 104 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 133 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 128 ms 10796 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 98 ms 10128 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 97 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 125 ms 10724 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 126 ms 10820 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10944 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 132 ms 10404 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 11224 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 11296 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 10824 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 177 ms 11516 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 268 ms 14700 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 9000 KB Execution killed with signal 11
3 Correct 92 ms 9732 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 9 ms 8968 KB Execution killed with signal 11
5 Correct 86 ms 9768 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 110 ms 10304 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 152 ms 10540 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 10024 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 107 ms 10256 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 10160 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 104 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 133 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 128 ms 10796 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 98 ms 10128 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 97 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 125 ms 10724 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 126 ms 10820 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10944 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 132 ms 10404 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 11224 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 11296 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 10824 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 177 ms 11516 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 268 ms 14700 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 9000 KB Execution killed with signal 11
3 Correct 92 ms 9732 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 9 ms 8968 KB Execution killed with signal 11
5 Correct 86 ms 9768 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 110 ms 10304 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 152 ms 10540 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 10024 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 107 ms 10256 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 10160 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 104 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 133 ms 10320 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 128 ms 10796 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 98 ms 10128 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 97 ms 10228 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 125 ms 10724 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 126 ms 10820 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 120 ms 10944 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 132 ms 10404 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 163 ms 11224 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 148 ms 11296 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 10824 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 177 ms 11516 KB Output is partially correct - 360000 call(s) of encode_bit()