답안 #357671

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
357671 2021-01-24T11:50:33 Z Mlxa Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 364 KB
#ifdef LC
#include "pch.h"
#else
#include <bits/stdc++.h>
#endif
using namespace std;
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define mp make_pair
#define mt make_tuple

int query(vector<int>);

const int N = 1e3;
vector<int> g[N];
vector<int> order;

void dfs(int v) {
	order.push_back(v);
	for (int u : g[v]) {
		g[u].erase(find(all(g[u]), v));
		dfs(u);
	}
}

bool check(int pref) {
	vector<int> cur;
	for (int i = 0; i < pref; ++i) {
		cur.push_back(order[i] + 1);
	}
	return (bool)query(cur);
}

int findEgg(int n, vector<pair<int, int>> edges) {
	fill_n(g, n, vector<int>());
	for (auto e : edges) {
		g[e.x].push_back(e.y - 1);
		g[e.y].push_back(e.x - 1);
	}
	order.clear();
	dfs(0);
	int lef = 0, rig = (int)order.size();
	while (rig - lef > 1) {
		int mid = (lef + rig) / 2;
		if (check(mid)) {
			rig = mid;
		} else {
			lef = mid;
		}
	}
	return lef + 1;
}

#ifdef LC
int query(vector<int>) {
	return 0;
}
signed main() {
    assert(freopen("input.txt", "r", stdin));
    ios::sync_with_stdio(0); cin.tie(0);
    
    return 0;
}
#endif
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB The found island is incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB The found island is incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -