답안 #345973

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
345973 2021-01-08T19:44:16 Z ahmet Easter Eggs (info1cup17_eastereggs) C++14
10 / 100
2 ms 492 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
#define ref(a,b,c) for(int (a)=(b);(a)<=(c);++(a))
#define rep(a,b) for(int (a)=0;(a)<(b);++(a))
#define ll long long
#define pb push_back
#define mp make_pair
vector <int> v[550];
int findEgg (int N, vector < pair < int, int > > bridges)
{
	for(int i=0;i<N-1;++i){
		int x=bridges[i].first;
		int y=bridges[i].second;
		v[x].pb(y);
		v[y].pb(x);
	}
	vector <int> vis(550,0);
	for(int i=1;i<=N;++i){
		for(int j=0;j<v[i].size();++j){
			int node=v[i][j];
			if(vis[node]+vis[i]==2)continue;
			if(query({i,node})){
				if(vis[node])return i;
				else if(vis[i])return node;
				else{
					if(query({i}))return i;
					else return node;
				}
			}
			else{
				vis[node]=1;
				vis[i]=1;
			}
		}
	}
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:20:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for(int j=0;j<v[i].size();++j){
      |               ~^~~~~~~~~~~~
eastereggs.cpp:18:24: warning: control reaches end of non-void function [-Wreturn-type]
   18 |  vector <int> vis(550,0);
      |                        ^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 364 KB Number of queries: 13
2 Partially correct 2 ms 364 KB Number of queries: 11
3 Partially correct 2 ms 364 KB Number of queries: 13
4 Partially correct 2 ms 364 KB Number of queries: 15
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 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 1 ms 492 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -