Submission #360338

# Submission time Handle Problem Language Result Execution time Memory
360338 2021-01-28T02:57:15 Z amunduzbaev Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
4 ms 620 KB
#include <bits/stdc++.h>
#include "grader.h"
 
#ifndef EVAL
#include "grader.cpp"
#endif
 
#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define pii pair<int, int>
 
using namespace std;
 
const int NN = 513;
vector<int> edges[NN];
vector<int> vv;
int nn;
 
void dfs(int u, int p = -1){
	vv.pb(u);
	for(auto x:edges[u]){
		if(x == p) continue;
		dfs(x, u);
	}
}

int findEgg (int N, vector < pair < int, int > > bb){
	for(int i=0;i<NN;i++) edges[i].clear();
	for(auto x:bb){
		edges[x.ff].pb(x.ss);
		edges[x.ss].pb(x.ff);
	}
	vv.clear();
	dfs(1);
	int l = 0, r = sz(vv)-1;
	
	while(l < r){
		int m = (l + r)>>1;
		vector<int> tt;
		for(int i=l;i<=m;i++) tt.pb(vv[i]);
		if(query(tt)) r = m;
		else l = m+1;
	}
	return vv[l];
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Number of queries: 4
2 Runtime error 1 ms 492 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 620 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -