Submission #872044

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

void query(vector<int> v);

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 n = N;
    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:29:44: error: invalid operands of types 'int' and 'void' to binary 'operator^'
   29 |         if(ans + pas <= n) ans += pas * (1 ^ query(get(ans+pas)));
      |                                          ~ ^ ~~~~~~~~~~~~~~~~~~~
      |                                          |        |
      |                                          int      void