Submission #565015

# Submission time Handle Problem Language Result Execution time Memory
565015 2022-05-20T07:47:12 Z 1zaid1 Saveit (IOI10_saveit) C++14
0 / 100
276 ms 16804 KB
#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
const int M = 1e5+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>> ans(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++) {
                ans[i][j] += decode_bit()*(1<<k);
            }
        }
    }

    for (int i = 0; i < 36; i++) {
        for (int j = 0; j < n; j++) {
            hops(i, j, ans[i][j]);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 276 ms 16804 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 11040 KB Execution killed with signal 11
3 Correct 93 ms 11764 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 8 ms 11008 KB Execution killed with signal 11
5 Correct 87 ms 12060 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 103 ms 12436 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 108 ms 12764 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 12104 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 113 ms 12288 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 97 ms 12316 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 115 ms 12412 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 102 ms 12248 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 123 ms 12932 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 104 ms 12332 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 111 ms 12364 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 119 ms 13008 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 111 ms 12828 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 13064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 115 ms 12608 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 147 ms 13320 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 152 ms 13432 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 130 ms 12996 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 141 ms 13664 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 276 ms 16804 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 11040 KB Execution killed with signal 11
3 Correct 93 ms 11764 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 8 ms 11008 KB Execution killed with signal 11
5 Correct 87 ms 12060 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 103 ms 12436 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 108 ms 12764 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 12104 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 113 ms 12288 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 97 ms 12316 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 115 ms 12412 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 102 ms 12248 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 123 ms 12932 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 104 ms 12332 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 111 ms 12364 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 119 ms 13008 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 111 ms 12828 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 13064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 115 ms 12608 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 147 ms 13320 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 152 ms 13432 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 130 ms 12996 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 141 ms 13664 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 276 ms 16804 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 11040 KB Execution killed with signal 11
3 Correct 93 ms 11764 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 8 ms 11008 KB Execution killed with signal 11
5 Correct 87 ms 12060 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 103 ms 12436 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 108 ms 12764 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 12104 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 113 ms 12288 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 97 ms 12316 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 115 ms 12412 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 102 ms 12248 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 123 ms 12932 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 104 ms 12332 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 111 ms 12364 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 119 ms 13008 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 111 ms 12828 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 13064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 115 ms 12608 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 147 ms 13320 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 152 ms 13432 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 130 ms 12996 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 141 ms 13664 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 276 ms 16804 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Runtime error 8 ms 11040 KB Execution killed with signal 11
3 Correct 93 ms 11764 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Runtime error 8 ms 11008 KB Execution killed with signal 11
5 Correct 87 ms 12060 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 103 ms 12436 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 108 ms 12764 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 95 ms 12104 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 113 ms 12288 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 97 ms 12316 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 115 ms 12412 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 102 ms 12248 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 123 ms 12932 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 104 ms 12332 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 111 ms 12364 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 119 ms 13008 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 111 ms 12828 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 115 ms 13064 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 115 ms 12608 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 147 ms 13320 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 152 ms 13432 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 130 ms 12996 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 141 ms 13664 KB Output is partially correct - 360000 call(s) of encode_bit()