Submission #524224

# Submission time Handle Problem Language Result Execution time Memory
524224 2022-02-08T20:20:27 Z CSQ31 Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

vector<int>adj[1000],a;
void dfs(int v,int u){
	a.push_back(v);
	for(int x:adj[v]){
		if(x==u)continue;
		dfs(x,v);
	}
}
int findEgg (int n, vector < pair < int, int > > bridges)
{
	for(auto x:bridges){
		adj[x.first].push_back(x.second);
		adj[x.second].push_back(x.first);
	}
	dfs(1,0);
	int l = 0,r = n-1;
	while(r>=l){
		int mid = (l+r)/2;
		vector<int>b;
		for(int i=0;i<=mid;i++)b.push_back(a[i]);
		if(query(b))r=mid-1;
		else l=mid+1;
	}
	assert(l<n)
	return a[l];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:29:2: error: expected ';' before 'return'
   29 |  return a[l];
      |  ^~~~~~
eastereggs.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^