Submission #687381

# Submission time Handle Problem Language Result Execution time Memory
687381 2023-01-26T11:18:03 Z heeheeheehaaw Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <vector>
#include "grader.h"

using namespace std;

int hei[512 + 5], heimax = 0, nrnod;
int fr[512 + 5];
vector<int> muc[512 + 5];
vector<int> qv;

void dfsinit(int nod, int anc)
{
    hei[nod] = hei[anc] + 1;
    fr[hei[nod]]++;
    heimax = max(heimax, hei[nod]);
    for(auto it: muc[nod])
        if(it != anc)
            dfsinit(it, nod);
}

void dfs(int nod, int anc, int limita)
{
    qv.push_back(nod);
    for(auto it: muc[nod])
        if(it != anc && hei[it] <= limita)
            dfs(it, nod, limita);
}

void dfslvl(int nod, int anc, int limita, int nrlim)
{
    if(hei[nod] == limita)
        nrnod++;
    qv.push_back(nod);
    for(auto it: muc[nod])
        if(it != anc && hei[it] <= limita && nrnod < nrlim)
            dfs(it, nod, limita);
}

int findEgg(int n, vector<pair<int, int>> bridges)
{
    for(auto it: bridges)
    {
        muc[it.first].push_back(it.second);
        muc[it.second].push_back(it.first);
    }
    dfsinit(1, 1);
    int st = 1, dr = heimax;
    while(st < dr)
    {
        qv.clear();
        int mij = (st + dr) / 2;
        dfs(1, 1, mij);
        bool val = query(qv);
        if(val == true)
            dr = mij;
        else
            st = mij + 1;
    }

    int level = st;
    st = 1, dr = fr[level];
    while(st < dr)
    {
        qv.clear();
        int mij = (st + dr) / 2;
        nrnod = 0;
        dfslvl(1, 1, level, mij);
        bool val = query(qv);
        if(val == true)
            dr = mij;
        else
            st = mij + 1;
    }
    return st;
}

int main()
{

    return 0;
}

Compilation message

/usr/bin/ld: /tmp/cc8vsTqO.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccQmJG4M.o:eastereggs.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status