Submission #243014

# Submission time Handle Problem Language Result Execution time Memory
243014 2020-06-30T07:40:36 Z daongocha Easter Eggs (info1cup17_eastereggs) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
#define int long long

#define For(i,a,b) for (int i = a; i <= (b); i++)
#define For2(i,a,b) for (int i = a; i >= (b); i--)

#define pii pair<int, int>
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define INF 2147483647
#define EPS 1e-9
#define fi first
#define se second
//f#define FILEOPEN

using namespace std;

vector<int> path[515];
vector<int> passed;

void dfs(int u, int prev) { 
	passed.pb(u);
	for (int v: path[u]) {
		if (v == prev) continue;
		dfs(v, u);
	}
}

int findEgg(int n, vector<pii> bridges) {
	For(i,1,n) path[i].clear();
	for (pii a: bridges) {
		path[a.fi].pb(a.se);
		path[a.se].pb(a.fi);
	}
	passed.clear(); passed.pb(0);
	dfs(1, 1);
	int l = 1, r = n;
	while (l < r) {
		int mid = (l + r) / 2;
		vector<int> a;
		For(i,1,mid) a.pb(passed[i]);
		if (query(a)) r = mid;
		else l = mid + 1;
	}
	return passed[l];
}

Compilation message

eastereggs.cpp: In function 'long long int findEgg(long long int, std::vector<std::pair<long long int, long long int> >)':
eastereggs.cpp:44:14: error: could not convert 'a' from 'std::vector<long long int>' to 'std::vector<int>'
   if (query(a)) r = mid;
              ^