Submission #565112

# Submission time Handle Problem Language Result Execution time Memory
565112 2022-05-20T09:48:31 Z Rifal Saveit (IOI10_saveit) C++14
25 / 100
232 ms 12684 KB
#include <bits/stdc++.h>
#include <fstream>
#include "grader.h"
#include "encoder.h"
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
const int M = 1005;
vector<int> v[M];
long long dist[M];
void bfs(int s)
{
    dist[s] = 0;
    queue<int> q;
    q.push(s);
    while(!q.empty())
    {
        int x = q.front();
        q.pop();
        for(auto i : v[x])
        {
            if(dist[i] == INF)
            {
                q.push(i);
                dist[i] = dist[x]+1;
            }
        }
    }
}
void encode(int n, int h, int p, int a[], int b[])
{
    for(int i = 0; i < p; i++)
    {
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < n; j++)
        {
            dist[j] = INF;
        }
        bfs(i);
       for(int j = 0; j < n; j++)
       {
           int y = dist[j];
           for(int q = 0; q < 11; q++)
           {
               if((y&(1<<q)) != 0)
               {
                   encode_bit(1);
               }
               else
               {
                   encode_bit(0);
               }
           }
       }
    }
 
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
void decode(int n, int h)
{
    long long pw2[11];
    pw2[0] = 1;
    for(int i = 1; i < 11; i++)
    {
        pw2[i] = pw2[i-1]*2;
    }
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < n; j++)
        {
            long long cnt = 0;
            for(int q = 0; q < 11; q++)
            {
                if(decode_bit() != 0)
                {
                    cnt += pw2[q];
                }
            }
            hops(i,j,cnt);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 232 ms 12684 KB Output is partially correct - 396000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 165 call(s) of encode_bit()
3 Correct 71 ms 7596 KB Output is partially correct - 356400 call(s) of encode_bit()
4 Correct 3 ms 4516 KB Output is correct - 275 call(s) of encode_bit()
5 Correct 75 ms 7808 KB Output is partially correct - 356400 call(s) of encode_bit()
6 Correct 73 ms 8016 KB Output is partially correct - 396000 call(s) of encode_bit()
7 Correct 83 ms 8352 KB Output is partially correct - 396000 call(s) of encode_bit()
8 Correct 73 ms 7692 KB Output is partially correct - 380556 call(s) of encode_bit()
9 Correct 82 ms 7956 KB Output is partially correct - 396000 call(s) of encode_bit()
10 Correct 81 ms 7876 KB Output is partially correct - 396000 call(s) of encode_bit()
11 Correct 73 ms 8020 KB Output is partially correct - 396000 call(s) of encode_bit()
12 Correct 88 ms 7872 KB Output is partially correct - 396000 call(s) of encode_bit()
13 Correct 106 ms 8580 KB Output is partially correct - 396000 call(s) of encode_bit()
14 Correct 86 ms 7932 KB Output is partially correct - 396000 call(s) of encode_bit()
15 Correct 76 ms 7904 KB Output is partially correct - 396000 call(s) of encode_bit()
16 Correct 109 ms 8372 KB Output is partially correct - 396000 call(s) of encode_bit()
17 Correct 87 ms 8332 KB Output is partially correct - 396000 call(s) of encode_bit()
18 Correct 122 ms 8548 KB Output is partially correct - 396000 call(s) of encode_bit()
19 Correct 83 ms 8180 KB Output is partially correct - 396000 call(s) of encode_bit()
20 Correct 105 ms 8928 KB Output is partially correct - 396000 call(s) of encode_bit()
21 Correct 109 ms 9040 KB Output is partially correct - 396000 call(s) of encode_bit()
22 Correct 93 ms 8516 KB Output is partially correct - 396000 call(s) of encode_bit()
23 Correct 114 ms 9236 KB Output is partially correct - 396000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 232 ms 12684 KB Output is partially correct - 396000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 165 call(s) of encode_bit()
3 Correct 71 ms 7596 KB Output is partially correct - 356400 call(s) of encode_bit()
4 Correct 3 ms 4516 KB Output is correct - 275 call(s) of encode_bit()
5 Correct 75 ms 7808 KB Output is partially correct - 356400 call(s) of encode_bit()
6 Correct 73 ms 8016 KB Output is partially correct - 396000 call(s) of encode_bit()
7 Correct 83 ms 8352 KB Output is partially correct - 396000 call(s) of encode_bit()
8 Correct 73 ms 7692 KB Output is partially correct - 380556 call(s) of encode_bit()
9 Correct 82 ms 7956 KB Output is partially correct - 396000 call(s) of encode_bit()
10 Correct 81 ms 7876 KB Output is partially correct - 396000 call(s) of encode_bit()
11 Correct 73 ms 8020 KB Output is partially correct - 396000 call(s) of encode_bit()
12 Correct 88 ms 7872 KB Output is partially correct - 396000 call(s) of encode_bit()
13 Correct 106 ms 8580 KB Output is partially correct - 396000 call(s) of encode_bit()
14 Correct 86 ms 7932 KB Output is partially correct - 396000 call(s) of encode_bit()
15 Correct 76 ms 7904 KB Output is partially correct - 396000 call(s) of encode_bit()
16 Correct 109 ms 8372 KB Output is partially correct - 396000 call(s) of encode_bit()
17 Correct 87 ms 8332 KB Output is partially correct - 396000 call(s) of encode_bit()
18 Correct 122 ms 8548 KB Output is partially correct - 396000 call(s) of encode_bit()
19 Correct 83 ms 8180 KB Output is partially correct - 396000 call(s) of encode_bit()
20 Correct 105 ms 8928 KB Output is partially correct - 396000 call(s) of encode_bit()
21 Correct 109 ms 9040 KB Output is partially correct - 396000 call(s) of encode_bit()
22 Correct 93 ms 8516 KB Output is partially correct - 396000 call(s) of encode_bit()
23 Correct 114 ms 9236 KB Output is partially correct - 396000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 232 ms 12684 KB Output is partially correct - 396000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 165 call(s) of encode_bit()
3 Correct 71 ms 7596 KB Output is partially correct - 356400 call(s) of encode_bit()
4 Correct 3 ms 4516 KB Output is correct - 275 call(s) of encode_bit()
5 Correct 75 ms 7808 KB Output is partially correct - 356400 call(s) of encode_bit()
6 Correct 73 ms 8016 KB Output is partially correct - 396000 call(s) of encode_bit()
7 Correct 83 ms 8352 KB Output is partially correct - 396000 call(s) of encode_bit()
8 Correct 73 ms 7692 KB Output is partially correct - 380556 call(s) of encode_bit()
9 Correct 82 ms 7956 KB Output is partially correct - 396000 call(s) of encode_bit()
10 Correct 81 ms 7876 KB Output is partially correct - 396000 call(s) of encode_bit()
11 Correct 73 ms 8020 KB Output is partially correct - 396000 call(s) of encode_bit()
12 Correct 88 ms 7872 KB Output is partially correct - 396000 call(s) of encode_bit()
13 Correct 106 ms 8580 KB Output is partially correct - 396000 call(s) of encode_bit()
14 Correct 86 ms 7932 KB Output is partially correct - 396000 call(s) of encode_bit()
15 Correct 76 ms 7904 KB Output is partially correct - 396000 call(s) of encode_bit()
16 Correct 109 ms 8372 KB Output is partially correct - 396000 call(s) of encode_bit()
17 Correct 87 ms 8332 KB Output is partially correct - 396000 call(s) of encode_bit()
18 Correct 122 ms 8548 KB Output is partially correct - 396000 call(s) of encode_bit()
19 Correct 83 ms 8180 KB Output is partially correct - 396000 call(s) of encode_bit()
20 Correct 105 ms 8928 KB Output is partially correct - 396000 call(s) of encode_bit()
21 Correct 109 ms 9040 KB Output is partially correct - 396000 call(s) of encode_bit()
22 Correct 93 ms 8516 KB Output is partially correct - 396000 call(s) of encode_bit()
23 Correct 114 ms 9236 KB Output is partially correct - 396000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 232 ms 12684 KB Output is partially correct - 396000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 165 call(s) of encode_bit()
3 Correct 71 ms 7596 KB Output is partially correct - 356400 call(s) of encode_bit()
4 Correct 3 ms 4516 KB Output is correct - 275 call(s) of encode_bit()
5 Correct 75 ms 7808 KB Output is partially correct - 356400 call(s) of encode_bit()
6 Correct 73 ms 8016 KB Output is partially correct - 396000 call(s) of encode_bit()
7 Correct 83 ms 8352 KB Output is partially correct - 396000 call(s) of encode_bit()
8 Correct 73 ms 7692 KB Output is partially correct - 380556 call(s) of encode_bit()
9 Correct 82 ms 7956 KB Output is partially correct - 396000 call(s) of encode_bit()
10 Correct 81 ms 7876 KB Output is partially correct - 396000 call(s) of encode_bit()
11 Correct 73 ms 8020 KB Output is partially correct - 396000 call(s) of encode_bit()
12 Correct 88 ms 7872 KB Output is partially correct - 396000 call(s) of encode_bit()
13 Correct 106 ms 8580 KB Output is partially correct - 396000 call(s) of encode_bit()
14 Correct 86 ms 7932 KB Output is partially correct - 396000 call(s) of encode_bit()
15 Correct 76 ms 7904 KB Output is partially correct - 396000 call(s) of encode_bit()
16 Correct 109 ms 8372 KB Output is partially correct - 396000 call(s) of encode_bit()
17 Correct 87 ms 8332 KB Output is partially correct - 396000 call(s) of encode_bit()
18 Correct 122 ms 8548 KB Output is partially correct - 396000 call(s) of encode_bit()
19 Correct 83 ms 8180 KB Output is partially correct - 396000 call(s) of encode_bit()
20 Correct 105 ms 8928 KB Output is partially correct - 396000 call(s) of encode_bit()
21 Correct 109 ms 9040 KB Output is partially correct - 396000 call(s) of encode_bit()
22 Correct 93 ms 8516 KB Output is partially correct - 396000 call(s) of encode_bit()
23 Correct 114 ms 9236 KB Output is partially correct - 396000 call(s) of encode_bit()