답안 #521889

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
521889 2022-02-03T11:27:11 Z maks007 Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 456 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

vector <int> listt;
vector <int> used;
vector <vector <int> > g;

int f = 0;
int ans = 0;

void dfs(int v) {
	if(f) return;

	listt.push_back(v+1);
	if(query(listt)) {
		ans = listt.back();
		f = 1;
		return;
	}
	for(auto u : g[v]) {
		if(f) return;
		if(!used[u]) {
			dfs(u);
		}
	}
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
	used.resize(N);
	g.resize(N);
	for(int i = 0; i < bridges.size(); i ++) {
		g[bridges[i].first - 1].push_back(bridges[i].second - 1);
		g[bridges[i].second - 1].push_back(bridges[i].first - 1);
	}
	ans = 0;
	f = 0;
	dfs(0);
	return ans;
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:34:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for(int i = 0; i < bridges.size(); i ++) {
      |                 ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -