Submission #744323

# Submission time Handle Problem Language Result Execution time Memory
744323 2023-05-18T12:21:15 Z MON Easter Eggs (info1cup17_eastereggs) C++14
Compilation error
0 ms 0 KB
#include <vector>
#include<cassert>
#include "grader.h"
using namespace std;

vector<int> vecini[513];

void dfs(int a = 1,int p = -1,vector<int> &e)
{
    e.emplace_back(a);
    for(auto &it : vecini[a])
        if(it != p) dfs(it,a);
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    for(int i = 1; i <= N ; i++) vecini[i].clear();
    vector<int> e;
    for(auto &it : bridges)
        {
            vecini[it.first].emplace_back(it.second);
            vecini[it.second].emplace_back(it.first);
        }

    dfs(1,-1,e); assert(e.size() == n + 1);
    int ans = 0,pas = 1; while(pas <= N) pas <<= 1;
    for(; pas ; pas >>= 1)
        {
            if(ans + pas >= N) continue;
            if(!query(vector<int>(e.begin() + 1,e.begin() + 1 + (ans + pas)))) ans += pas;
        }

    return ans + 1;
}

Compilation message

eastereggs.cpp:8:44: error: default argument missing for parameter 3 of 'void dfs(int, int, std::vector<int>&)'
    8 | void dfs(int a = 1,int p = -1,vector<int> &e)
      |                               ~~~~~~~~~~~~~^
eastereggs.cpp:8:14: note: ...following parameter 1 which has a default argument
    8 | void dfs(int a = 1,int p = -1,vector<int> &e)
      |          ~~~~^~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from grader.h:1,
                 from eastereggs.cpp:3:
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:25:37: error: 'n' was not declared in this scope
   25 |     dfs(1,-1,e); assert(e.size() == n + 1);
      |                                     ^