Submission #2949

# Submission time Handle Problem Language Result Execution time Memory
2949 2013-08-18T06:06:36 Z tncks0121 Saveit (IOI10_saveit) C++
50 / 100
303 ms 13728 KB
#include "grader.h"
#include "encoder.h"
#include <stdlib.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

static int Que[1005], Qf, Qr;
static vector<int> Gph[1005];
static int Len[1005];
static bool visited[1005];

void send (ll v, int b) {
    for(int i = 0; i < b; i++) encode_bit(!!((v>>i)&1));
}

void encode(int nv, int nh, int ne, int *v1, int *v2){
    int i, j;
    
    for(i = 0; i < ne; i++) {
        int u = v1[i], v = v2[i];
        Gph[u].push_back(v);
        Gph[v].push_back(u);
    }
    
    for(i = 0; i < nh; i++) {
        Qf = Qr = 0; Que[++Qr] = i;
        memset(visited, 0, sizeof visited);
        memset(Len, 0, sizeof Len);
        visited[i] = true;
        while(Qf < Qr) {
            int u = Que[++Qf];
            //printf("%d ", u);
            for(j = 0; j < Gph[u].size(); j++) {
                int v = Gph[u][j];
                if(!visited[v]) visited[v] = true, Len[v] = Len[u]+1, visited[v] = true, Que[++Qr] = v;
            }
        }
        //puts("");
        for(j = 0; j < nv; j++) send(Len[j], 10);
    }
}
#include "grader.h"
#include "decoder.h"
#include <stdlib.h>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll get (int b) {
    int i; ll ret = 0;
    for(i = 0; i < b; i++) if(decode_bit()) ret |= 1ll << i;
    return ret;
}

void decode(int nv, int nh) {
    for(int i = 0; i < nh; i++) {
        for(int j = 0; j < nv; j++) {
            hops(i, j, get(10));
        }
    }
}

Compilation message

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:36:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(j = 0; j < Gph[u].size(); j++) {
                        ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 303 ms 13728 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 7 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 75 ms 7504 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 7 ms 4632 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 82 ms 7640 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 141 ms 8256 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 78 ms 7648 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 83 ms 7820 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 81 ms 7800 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 95 ms 7952 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 86 ms 7864 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 109 ms 8392 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 83 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 110 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 8212 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 109 ms 8540 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 87 ms 8128 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 135 ms 8860 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 145 ms 8872 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8348 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 146 ms 9188 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 303 ms 13728 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 7 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 75 ms 7504 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 7 ms 4632 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 82 ms 7640 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 141 ms 8256 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 78 ms 7648 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 83 ms 7820 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 81 ms 7800 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 95 ms 7952 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 86 ms 7864 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 109 ms 8392 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 83 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 110 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 8212 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 109 ms 8540 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 87 ms 8128 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 135 ms 8860 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 145 ms 8872 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8348 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 146 ms 9188 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 303 ms 13728 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 7 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 75 ms 7504 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 7 ms 4632 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 82 ms 7640 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 141 ms 8256 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 78 ms 7648 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 83 ms 7820 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 81 ms 7800 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 95 ms 7952 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 86 ms 7864 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 109 ms 8392 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 83 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 110 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 8212 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 109 ms 8540 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 87 ms 8128 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 135 ms 8860 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 145 ms 8872 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8348 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 146 ms 9188 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 303 ms 13728 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 7 ms 4672 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 75 ms 7504 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 7 ms 4632 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 82 ms 7640 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7936 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 141 ms 8256 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 78 ms 7648 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 83 ms 7820 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 81 ms 7800 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 95 ms 7952 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 86 ms 7864 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 109 ms 8392 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 83 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 110 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 106 ms 8212 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 109 ms 8540 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 87 ms 8128 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 135 ms 8860 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 145 ms 8872 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8348 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 146 ms 9188 KB Output is partially correct - 360000 call(s) of encode_bit()