Submission #283231

# Submission time Handle Problem Language Result Execution time Memory
283231 2020-08-25T11:47:14 Z dsjong Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 640 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

vector<int>adj[600];
vector<int>tour, cur;
void dfs(int x, int p){
	tour.push_back(x);
	for(int y:adj[x]){
		if(y==p) continue;
		dfs(y, x);
	}
}

bool ask(int x){
	cur.clear();
	for(int i=0;i<=x;i++){
		cur.push_back(tour[i]);
	}
	return query(cur);
}

int findEgg (int N, vector<pair<int, int>> bridges){
	for(int i=1;i<=N;i++){
		adj[i].clear();
	}
	for(auto p: bridges){
		int x=p.first, y=p.second;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	tour.clear();
	dfs(1, 0);
	cout<<tour.size()<<endl;
	int L=0, R=N-1;
	while(L<R){
		int M=(L+R)/2;
		if(ask(M)) R=M;
		else L=M+1;
	}
	return tour[L];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -