Submission #61547

# Submission time Handle Problem Language Result Execution time Memory
61547 2018-07-26T07:27:32 Z DrumpfTheGodEmperor Easter Eggs (info1cup17_eastereggs) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
#define MOD 1000000007
#define INF 1061109567
#define pb push_back
#define in(s) freopen(s,"r",stdin);
#define out(s) freopen(s,"w",stdout);
#define fi first
#define se second
#define bw(i,r,l) for (int i=r-1;i>=l;i--)
#define fw(i,l,r) for (int i=l;i<r;i++)
#define fa(i,x) for (auto i:x)
using namespace std;
const int N=525;
int sz[N];
vector<int> vec,G[N],ask;
void dfs(int u,int p) {
	vec.pb(u);
	fa (v,G[u]) if (v!=p) dfs(v,u);
}
int findEgg(int n,vector<pair<int,int>> bridges) {
	fa (i,bridges) {
		G[i.fi].pb(i.se);
		G[i.se].pb(i.fi);
	}
	dfs(1,0);
	int l=0,r=vec.size()-1;
	while (l<r) {
		int mid=(l+r)/2;
		ask.clear();
		fw (i,l,mid+1) ask.pb(vec[i]);
		if (query(ans)) r=mid;
		else l=mid+1;
	}
	return v[l];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:32:13: error: 'ans' was not declared in this scope
   if (query(ans)) r=mid;
             ^~~
eastereggs.cpp:32:13: note: suggested alternative: 'abs'
   if (query(ans)) r=mid;
             ^~~
             abs
eastereggs.cpp:35:9: error: 'v' was not declared in this scope
  return v[l];
         ^