답안 #282950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
282950 2020-08-25T07:43:20 Z dsjong Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
399 ms 131076 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(auto [x, y]: bridges){
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	dfs(1, 0);
	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];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:24:11: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   24 |  for(auto [x, y]: bridges){
      |           ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 399 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 294 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 291 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -