Submission #565037

# Submission time Handle Problem Language Result Execution time Memory
565037 2022-05-20T08:01:44 Z AbdullahMW Saveit (IOI10_saveit) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#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();
        
        vis[x] = true;
        cnt++;
        for (auto v : gr[x])
        {
            if (!vis[v])
            {
                q.push(v);
                ret.pb({v, cnt});
            }
        }
    }
    
    return ret;
}

ll encode_bit(ll b)
{
    return b;
}

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());
        for (auto v : vec)
        {
            for (ll b = 0; b < 10; b++)
            {
                encode_bit((1 << b) & v.s);
            }
        }
    }
}

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

using namespace std;

ll decode_bit()
{
    
}

ll hops(ll h, ll c, ll d)
{
    return d;
}

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


    

Compilation message

/usr/bin/ld: /tmp/ccrzlZi3.o: in function `encode_bit(int)':
encoder.cpp:(.text+0x500): multiple definition of `encode_bit(int)'; /tmp/ccl8RRHY.o:grader_encoder.c:(.text+0x40): first defined here
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'int decode_bit()':
decoder.cpp:12:1: warning: no return statement in function returning non-void [-Wreturn-type]
   12 | }
      | ^
/usr/bin/ld: /tmp/ccHnXouN.o: in function `decode_bit()':
decoder.cpp:(.text.unlikely+0x0): multiple definition of `decode_bit()'; /tmp/ccoxi5JM.o:grader_decoder.c:(.text+0x40): first defined here
/usr/bin/ld: /tmp/ccHnXouN.o: in function `hops(int, int, int)':
decoder.cpp:(.text+0x0): multiple definition of `hops(int, int, int)'; /tmp/ccoxi5JM.o:grader_decoder.c:(.text+0x80): first defined here
collect2: error: ld returned 1 exit status