Submission #872043

# Submission time Handle Problem Language Result Execution time Memory
872043 2023-11-12T07:51:05 Z MON Easter Eggs (info1cup17_eastereggs) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#include<vector>
using namespace std;

vector<int> vecini[513]; vector<int> v;

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

vector<int> get(int p)
{
    vector<int> g;
    for(int i = 0 ; i < p ; i++) g.emplace_back(v[i]);
    return g;
}

int findEgg(int N, vector<pair<int,int>> bridges)
{
    for(auto &it : bridges) vecini[it.first].emplace_back(it.second),vecini[it.second].emplace_back(it.first);
    dfs(1);
    int pas = 1, ans = 0; for(; pas <= N ; pas <<= 1);
    for(; pas ; pas >>= 1)
        if(ans + pas <= n) ans += pas * (1 ^ query(get(ans+pas)));
    return v[ans];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:27:25: error: 'n' was not declared in this scope
   27 |         if(ans + pas <= n) ans += pas * (1 ^ query(get(ans+pas)));
      |                         ^
eastereggs.cpp:27:46: error: 'query' was not declared in this scope
   27 |         if(ans + pas <= n) ans += pas * (1 ^ query(get(ans+pas)));
      |                                              ^~~~~