Submission #243052

# Submission time Handle Problem Language Result Execution time Memory
243052 2020-06-30T08:21:09 Z Xenocryptix Easter Eggs (info1cup17_eastereggs) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
vector<int> g[10000], q;

void dfs(int u, int f = -1) {
	q.pb(u);
	for(int i: g[u])
		if(i != f)
			dfs(i, u)
}

int bin_search(int l, int r) {
	while(l < r) {
		m = (l + r) >> 1;
		if(query(vector<int>(q.begin(), q.begin() + m)))
            r = m;
        else
            l = m + 1;
	}
	return l;
}

int findEgg(int N, vector< pair<int, int> > bridges) {
	for(auto i: bridges) {
		g[i.fi].pb(i.se);
		g[i.se].pb(i.fi);
	}
	dfs(1);
	return q[bin_search(1, N) - 1];
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:15:1: error: expected ';' before '}' token
 }
 ^
eastereggs.cpp: In function 'int bin_search(int, int)':
eastereggs.cpp:19:3: error: 'm' was not declared in this scope
   m = (l + r) >> 1;
   ^