답안 #144107

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144107 2019-08-16T04:39:26 Z Flying_dragon_02 Easter Eggs (info1cup17_eastereggs) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
//#include "grader.h"
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
typedef pair<int, int> ii;
 
vector<int> graph[600];
int child[600], m, root, par[600], ok = 0, arr[600], num = 1;
bool vis1[600], vis2[600];
vector<int> ask;
 
void dfs(int u, int p){
	arr[num] = u; num++;
    for(int i = 0; i < graph[u].size(); i++){
        int v = graph[u][i];
        if(v == p) continue;
        dfs(v, u);
    }
}
 
int findEgg(int N, vector<ii> bridges){
	for(int i = 1; i <= N; i++)
		graph[i].clear();
	num = 1;
    for(int i = 0; i < bridges.size(); i++){
        int u = bridges[i].fi, v = bridges[i].se;
        graph[u].pb(v); graph[v].pb(u);
    }
    dfs(1, 1);
    int l = 1, r = N, mid;
    while(l < r){
    	mid = (l + r) / 2;
    	ask.clear();
    	for(int j = 1; j <= mid; j++)
    		ask.pb(arr[j]);
    	if(query(ask)) r = mid;
    	else
    	l = mid + 1;
	}
	return arr[l];
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:19:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < graph[u].size(); i++){
                    ~~^~~~~~~~~~~~~~~~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:30:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < bridges.size(); i++){
                    ~~^~~~~~~~~~~~~~~~
eastereggs.cpp:41:9: error: 'query' was not declared in this scope
      if(query(ask)) r = mid;
         ^~~~~