답안 #334419

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334419 2020-12-09T06:26:07 Z limabeans Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
2 ms 568 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);
    int lo = 1;
    int hi = n;
    while (hi-lo>1) {
	int mid = (lo+hi)/2;
	if (query(vector<int>(w.begin(), w.begin()+mid+1))) {
	    lo = mid;
	} else {
	    hi = mid;
	}
    }

    return w[lo];
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 520 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 568 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -