답안 #565067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565067 2022-05-20T08:36:51 Z AbdullahMW 저장 (Saveit) (IOI10_saveit) C++14
0 / 100
393 ms 15332 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 < 20; 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 < 20; bit++)
            {
                bool b = decode_bit();
                if (b) d += (1 << bit);
            }
            hops(i, j, d);
        }
    }
}


    
# 결과 실행 시간 메모리 Grader output
1 Incorrect 393 ms 15332 KB Output isn't correct
2 Correct 2 ms 4612 KB Output is correct - 300 call(s) of encode_bit()
3 Incorrect 118 ms 9944 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 500 call(s) of encode_bit()
5 Incorrect 147 ms 10008 KB Output isn't correct
6 Incorrect 157 ms 10608 KB Output isn't correct
7 Incorrect 146 ms 10980 KB Output isn't correct
8 Incorrect 134 ms 10200 KB Output isn't correct
9 Incorrect 182 ms 10508 KB Output isn't correct
10 Incorrect 137 ms 10408 KB Output isn't correct
11 Incorrect 184 ms 10576 KB Output isn't correct
12 Incorrect 129 ms 10408 KB wrong parameter
13 Incorrect 172 ms 10988 KB wrong parameter
14 Incorrect 135 ms 10688 KB wrong parameter
15 Incorrect 127 ms 10440 KB wrong parameter
16 Incorrect 190 ms 10876 KB wrong parameter
17 Incorrect 153 ms 10936 KB wrong parameter
18 Incorrect 157 ms 11204 KB wrong parameter
19 Incorrect 137 ms 10756 KB wrong parameter
20 Incorrect 178 ms 11564 KB wrong parameter
21 Incorrect 196 ms 11568 KB wrong parameter
22 Incorrect 167 ms 11208 KB wrong parameter
23 Incorrect 193 ms 11776 KB wrong parameter
# 결과 실행 시간 메모리 Grader output
1 Incorrect 393 ms 15332 KB Output isn't correct
2 Correct 2 ms 4612 KB Output is correct - 300 call(s) of encode_bit()
3 Incorrect 118 ms 9944 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 500 call(s) of encode_bit()
5 Incorrect 147 ms 10008 KB Output isn't correct
6 Incorrect 157 ms 10608 KB Output isn't correct
7 Incorrect 146 ms 10980 KB Output isn't correct
8 Incorrect 134 ms 10200 KB Output isn't correct
9 Incorrect 182 ms 10508 KB Output isn't correct
10 Incorrect 137 ms 10408 KB Output isn't correct
11 Incorrect 184 ms 10576 KB Output isn't correct
12 Incorrect 129 ms 10408 KB wrong parameter
13 Incorrect 172 ms 10988 KB wrong parameter
14 Incorrect 135 ms 10688 KB wrong parameter
15 Incorrect 127 ms 10440 KB wrong parameter
16 Incorrect 190 ms 10876 KB wrong parameter
17 Incorrect 153 ms 10936 KB wrong parameter
18 Incorrect 157 ms 11204 KB wrong parameter
19 Incorrect 137 ms 10756 KB wrong parameter
20 Incorrect 178 ms 11564 KB wrong parameter
21 Incorrect 196 ms 11568 KB wrong parameter
22 Incorrect 167 ms 11208 KB wrong parameter
23 Incorrect 193 ms 11776 KB wrong parameter
# 결과 실행 시간 메모리 Grader output
1 Incorrect 393 ms 15332 KB Output isn't correct
2 Correct 2 ms 4612 KB Output is correct - 300 call(s) of encode_bit()
3 Incorrect 118 ms 9944 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 500 call(s) of encode_bit()
5 Incorrect 147 ms 10008 KB Output isn't correct
6 Incorrect 157 ms 10608 KB Output isn't correct
7 Incorrect 146 ms 10980 KB Output isn't correct
8 Incorrect 134 ms 10200 KB Output isn't correct
9 Incorrect 182 ms 10508 KB Output isn't correct
10 Incorrect 137 ms 10408 KB Output isn't correct
11 Incorrect 184 ms 10576 KB Output isn't correct
12 Incorrect 129 ms 10408 KB wrong parameter
13 Incorrect 172 ms 10988 KB wrong parameter
14 Incorrect 135 ms 10688 KB wrong parameter
15 Incorrect 127 ms 10440 KB wrong parameter
16 Incorrect 190 ms 10876 KB wrong parameter
17 Incorrect 153 ms 10936 KB wrong parameter
18 Incorrect 157 ms 11204 KB wrong parameter
19 Incorrect 137 ms 10756 KB wrong parameter
20 Incorrect 178 ms 11564 KB wrong parameter
21 Incorrect 196 ms 11568 KB wrong parameter
22 Incorrect 167 ms 11208 KB wrong parameter
23 Incorrect 193 ms 11776 KB wrong parameter
# 결과 실행 시간 메모리 Grader output
1 Incorrect 393 ms 15332 KB Output isn't correct
2 Correct 2 ms 4612 KB Output is correct - 300 call(s) of encode_bit()
3 Incorrect 118 ms 9944 KB Output isn't correct
4 Correct 3 ms 4604 KB Output is correct - 500 call(s) of encode_bit()
5 Incorrect 147 ms 10008 KB Output isn't correct
6 Incorrect 157 ms 10608 KB Output isn't correct
7 Incorrect 146 ms 10980 KB Output isn't correct
8 Incorrect 134 ms 10200 KB Output isn't correct
9 Incorrect 182 ms 10508 KB Output isn't correct
10 Incorrect 137 ms 10408 KB Output isn't correct
11 Incorrect 184 ms 10576 KB Output isn't correct
12 Incorrect 129 ms 10408 KB wrong parameter
13 Incorrect 172 ms 10988 KB wrong parameter
14 Incorrect 135 ms 10688 KB wrong parameter
15 Incorrect 127 ms 10440 KB wrong parameter
16 Incorrect 190 ms 10876 KB wrong parameter
17 Incorrect 153 ms 10936 KB wrong parameter
18 Incorrect 157 ms 11204 KB wrong parameter
19 Incorrect 137 ms 10756 KB wrong parameter
20 Incorrect 178 ms 11564 KB wrong parameter
21 Incorrect 196 ms 11568 KB wrong parameter
22 Incorrect 167 ms 11208 KB wrong parameter
23 Incorrect 193 ms 11776 KB wrong parameter