Submission #334427

# Submission time Handle Problem Language Result Execution time Memory
334427 2020-12-09T06:33:34 Z limabeans Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;


vector<int> g[600];

vector<int> w;

void dfs(int at, int p) {
    w.push_back(at);
    for (int to: g[at]) {
	if (to == p) continue;
	dfs(to, at);
    }
}

int findEgg (int n, vector < pair < int, int > > edges) {
    for (int i=0; i<=n; i++) {
	g[i].clear();
    }
    for (auto ed: edges) {
	int u = ed.first;
	int v = ed.second;
	g[u].push_back(v);
	g[v].push_back(u);
    }



    w.clear();
    dfs(1,0);

    assert((int)w.size()==n);

    return -1;


    int lo = 0;
    int hi = n;
    while (hi-lo>1) {
	int mid = (lo+hi)/2;
	if (query(vector<int>(w.begin(), w.begin()+1))) {
	    lo = mid;
	} else {
	    hi = mid;
	}
    }

    return w[lo];
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB The found island is incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB The found island is incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -