답안 #385693

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385693 2021-04-04T18:31:35 Z Iwanttobreakfree Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
2 ms 492 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

int findEgg (int N, vector < pair < int, int > > bridges){
	vector<int> lista(N);
	set<int> s;
	int cont=0;
	for(int i=0;i<N-1;i++){
		if(s.find(bridges[i].first)==s.end()){
			lista[s.size()]==bridges[i].first;
			s.insert(bridges[i].first);
		}
		if(s.find(bridges[i].second)==s.end()){
			lista[s.size()]==bridges[i].second;
			s.insert(bridges[i].second);
		}
	}
	int l=0,r=N-1,sol;
	vector<int> v;
	while(l<=r){
		v.clear();
		int mid=(r-l)/2+l;
		for(int i=l;i<=mid;i++)v.push_back(lista[i]);
		if(query(v)){
			sol=mid;
			r=mid-1;
		}
		else l=mid+1;
	}
    return sol;
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:12:19: warning: value computed is not used [-Wunused-value]
   12 |    lista[s.size()]==bridges[i].first;
eastereggs.cpp:16:19: warning: value computed is not used [-Wunused-value]
   16 |    lista[s.size()]==bridges[i].second;
eastereggs.cpp:9:6: warning: unused variable 'cont' [-Wunused-variable]
    9 |  int cont=0;
      |      ^~~~
eastereggs.cpp:32:12: warning: 'sol' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |     return sol;
      |            ^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -