Submission #565064

# Submission time Handle Problem Language Result Execution time Memory
565064 2022-05-20T08:33:27 Z AbdullahMW Saveit (IOI10_saveit) C++14
0 / 100
336 ms 12680 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"

#define newl "\n"
#define ll int
#define pb push_back
#define f first
#define s second

using namespace std;


vector <ll> gr[1005];
vector <pair <ll, ll>> bfs(ll xx)
{
    ll cnt = 0;
    vector <pair <ll, ll>> ret;
    queue <ll> q;
    unordered_map <ll, bool> vis;
    
    q.push(xx);
    ret.pb({xx, 0});
    vis[xx] = true;
    while (q.size())
    {
        ll x = q.front();
        q.pop();
        
        cnt++;
        for (auto v : gr[x])
        {
            if (!vis[v])
            {
                q.push(v);
                ret.pb({v, cnt});
                vis[v] = true;
            }
        }
    }
    
    return ret;
}

void encode(ll n, ll h, ll p, ll a[], ll b[])
{
    for (ll i = 0; i < p; i++)
    {
        gr[a[i]].pb(b[i]);
        gr[b[i]].pb(a[i]);
    }
    
    for (ll i = 0; i < h; i++)
    {
        vector <pair <ll, ll>> vec = bfs(i);
        sort(vec.begin(), vec.end());
        //cout << "HUB: " << i << "  ";
        for (auto v : vec)
        {
            //cout << "City: " << v.f;
            //cout << " Dist: ";
            //cout << v.s;
            for (ll b = 0; b < 11; b++)
            {
                bool bit = (1 << b) & v.s;
                //cout << bit;
                encode_bit(bit);
            }
            //cout << " ";
        }
        //cout << newl;
    }
}

/*int main()
{
    ll a[] = {0, 0, 0, 0, 1, 1, 1};
    ll b[] = {1, 2, 3, 4, 2, 3, 4};
    ll n = 5, h = 3, p = 7;
    encode(n, h, p, a, b);
}*/

    
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
#define ll int
#define pb push_back
#define f first
#define s second

using namespace std;



void decode(ll n, ll h)
{
    for (ll i = 0; i < h; i++)
    {
        for (ll j = 0; j < n; j++)
        {
            ll d = 0;
            for (ll bit = 0; bit < 11; bit++)
            {
                ll b = decode_bit();
                if (b == 1) d += (1 << bit);
            }
            hops(i, j, d);
        }
    }
}


    
# Verdict Execution time Memory Grader output
1 Incorrect 336 ms 12680 KB Output isn't correct
2 Correct 1 ms 4612 KB Output is correct - 165 call(s) of encode_bit()
3 Incorrect 80 ms 7676 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 275 call(s) of encode_bit()
5 Incorrect 79 ms 7808 KB Output isn't correct
6 Incorrect 100 ms 7976 KB Output isn't correct
7 Incorrect 99 ms 8336 KB Output isn't correct
8 Incorrect 75 ms 7836 KB Output isn't correct
9 Incorrect 91 ms 7948 KB Output isn't correct
10 Incorrect 93 ms 7916 KB Output isn't correct
11 Incorrect 108 ms 8012 KB Output isn't correct
12 Incorrect 73 ms 7836 KB wrong parameter
13 Incorrect 107 ms 8528 KB wrong parameter
14 Incorrect 75 ms 7956 KB wrong parameter
15 Incorrect 77 ms 7964 KB wrong parameter
16 Incorrect 105 ms 8384 KB wrong parameter
17 Incorrect 97 ms 8368 KB wrong parameter
18 Incorrect 117 ms 8660 KB wrong parameter
19 Incorrect 93 ms 8220 KB wrong parameter
20 Incorrect 120 ms 8972 KB wrong parameter
21 Incorrect 136 ms 9452 KB wrong parameter
22 Incorrect 111 ms 8560 KB wrong parameter
23 Incorrect 137 ms 9312 KB wrong parameter
# Verdict Execution time Memory Grader output
1 Incorrect 336 ms 12680 KB Output isn't correct
2 Correct 1 ms 4612 KB Output is correct - 165 call(s) of encode_bit()
3 Incorrect 80 ms 7676 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 275 call(s) of encode_bit()
5 Incorrect 79 ms 7808 KB Output isn't correct
6 Incorrect 100 ms 7976 KB Output isn't correct
7 Incorrect 99 ms 8336 KB Output isn't correct
8 Incorrect 75 ms 7836 KB Output isn't correct
9 Incorrect 91 ms 7948 KB Output isn't correct
10 Incorrect 93 ms 7916 KB Output isn't correct
11 Incorrect 108 ms 8012 KB Output isn't correct
12 Incorrect 73 ms 7836 KB wrong parameter
13 Incorrect 107 ms 8528 KB wrong parameter
14 Incorrect 75 ms 7956 KB wrong parameter
15 Incorrect 77 ms 7964 KB wrong parameter
16 Incorrect 105 ms 8384 KB wrong parameter
17 Incorrect 97 ms 8368 KB wrong parameter
18 Incorrect 117 ms 8660 KB wrong parameter
19 Incorrect 93 ms 8220 KB wrong parameter
20 Incorrect 120 ms 8972 KB wrong parameter
21 Incorrect 136 ms 9452 KB wrong parameter
22 Incorrect 111 ms 8560 KB wrong parameter
23 Incorrect 137 ms 9312 KB wrong parameter
# Verdict Execution time Memory Grader output
1 Incorrect 336 ms 12680 KB Output isn't correct
2 Correct 1 ms 4612 KB Output is correct - 165 call(s) of encode_bit()
3 Incorrect 80 ms 7676 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 275 call(s) of encode_bit()
5 Incorrect 79 ms 7808 KB Output isn't correct
6 Incorrect 100 ms 7976 KB Output isn't correct
7 Incorrect 99 ms 8336 KB Output isn't correct
8 Incorrect 75 ms 7836 KB Output isn't correct
9 Incorrect 91 ms 7948 KB Output isn't correct
10 Incorrect 93 ms 7916 KB Output isn't correct
11 Incorrect 108 ms 8012 KB Output isn't correct
12 Incorrect 73 ms 7836 KB wrong parameter
13 Incorrect 107 ms 8528 KB wrong parameter
14 Incorrect 75 ms 7956 KB wrong parameter
15 Incorrect 77 ms 7964 KB wrong parameter
16 Incorrect 105 ms 8384 KB wrong parameter
17 Incorrect 97 ms 8368 KB wrong parameter
18 Incorrect 117 ms 8660 KB wrong parameter
19 Incorrect 93 ms 8220 KB wrong parameter
20 Incorrect 120 ms 8972 KB wrong parameter
21 Incorrect 136 ms 9452 KB wrong parameter
22 Incorrect 111 ms 8560 KB wrong parameter
23 Incorrect 137 ms 9312 KB wrong parameter
# Verdict Execution time Memory Grader output
1 Incorrect 336 ms 12680 KB Output isn't correct
2 Correct 1 ms 4612 KB Output is correct - 165 call(s) of encode_bit()
3 Incorrect 80 ms 7676 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 275 call(s) of encode_bit()
5 Incorrect 79 ms 7808 KB Output isn't correct
6 Incorrect 100 ms 7976 KB Output isn't correct
7 Incorrect 99 ms 8336 KB Output isn't correct
8 Incorrect 75 ms 7836 KB Output isn't correct
9 Incorrect 91 ms 7948 KB Output isn't correct
10 Incorrect 93 ms 7916 KB Output isn't correct
11 Incorrect 108 ms 8012 KB Output isn't correct
12 Incorrect 73 ms 7836 KB wrong parameter
13 Incorrect 107 ms 8528 KB wrong parameter
14 Incorrect 75 ms 7956 KB wrong parameter
15 Incorrect 77 ms 7964 KB wrong parameter
16 Incorrect 105 ms 8384 KB wrong parameter
17 Incorrect 97 ms 8368 KB wrong parameter
18 Incorrect 117 ms 8660 KB wrong parameter
19 Incorrect 93 ms 8220 KB wrong parameter
20 Incorrect 120 ms 8972 KB wrong parameter
21 Incorrect 136 ms 9452 KB wrong parameter
22 Incorrect 111 ms 8560 KB wrong parameter
23 Incorrect 137 ms 9312 KB wrong parameter