Submission #1139150

#TimeUsernameProblemLanguageResultExecution timeMemory
1139150MuhammetPermutation Recovery (info1cup17_permutation)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
// #include "grader.h"
// #include "grader.cpp"

#define SZ(s) (int)s.size()

using namespace std;

vector <vector <int>> ve;

vector <int> path;

void dfs(int x, int y){
    path.push_back(x);
    for(auto i : ve[x]){
        if(i == y) continue;
        dfs(i,x);
        path.push_back(x);
    }
}

int findEgg (int n, vector < pair < int, int > > briges) {
    ve.resize(n+1);
    for(auto [i,j] : briges){
        ve[i].push_back(j);
        ve[j].push_back(i);
    }
    dfs(1,0);
    int l = 0, r = SZ(path)-1;
    map <int,bool> vis;
    while(l < r){
        int md = (l + r) / 2;
        vis.clear();
        vector <int> qwe;
        for(int i = l; i <= md; i++){
            if(vis.find(path[i]) == vis.end()) qwe.push_back(path[i]), vis[path[i]] = true;
        }
        if(query(qwe)) r = md;
        else l = md+1;
    }
    return path[l];
}

Compilation message (stderr)

Main.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
Main.cpp:38:12: error: 'query' was not declared in this scope
   38 |         if(query(qwe)) r = md;
      |            ^~~~~