Submission #1057153

# Submission time Handle Problem Language Result Execution time Memory
1057153 2024-08-13T14:35:05 Z Drifter24 Easter Eggs (info1cup17_eastereggs) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

void dfs(int v, int p, vector<vector<int>>& adj, vector<int>& ans){
	ans.push_back(v);
	for(int u:adj[v]){
		if(u==p)continue;
		dfs(u, v, adj, ans);
	}
}

int findEgg(int N, vector < pair < int, int > > bridges){
	vector<int> ans;
	vector<vector<int>> adj(N+1, vector<int>());
	for(auto x:bridges){
		adj[x.first].push_back(x.second);
		adj[x.second].push_back(x.first);
	}
	dfs(1, 0, adj, ans);
	int l=1,r=N;
	while(l<=r){
		int m=l+(r-l)/2;
		vector<int> q;
		for(int i=0;i<m;++i)q.push_back(ans[i]);
		if(query(q))r=m-1;
		else l=m+1;
	}
	return ans[min(N, r+1)-1];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:25:6: error: 'query' was not declared in this scope
   25 |   if(query(q))r=m-1;
      |      ^~~~~