답안 #763493

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
763493 2023-06-22T11:27:31 Z Quan2003 Easter Eggs (info1cup17_eastereggs) C++17
컴파일 오류
0 ms 0 KB
#include "grader.h"
#include "bits/stdc++.h"
using namespace std; 
#define MAXN (int) 1e6 + 5 
#define mp make_pair
#define pii pair<int,int>
vector<int> order; 
vector<int>adj[MAXN]; 
void dfs(int u, int p)
{
     order.push_back(u); 
     for(int i = 0; i < adj[u].size(); i++)
     {
         int v = adj[u][i];
         if(v == p) continue; 
         dfs(v,u); 
     }
}
int find_egg(int n, vector<pii> bridges)
{
     for(int i = 0; i < (int) bridges.size(); i++)
     {
         int u = bridges[i].first; 
         int v = bridges[i].second;
         adj[u].push_back(v);
         adj[v].push_back(u); 
     }
     dfs(1, 0); 
     int l = 0; 
     int r = n - 1; 
     while(l < r)
     {
         int mid = (l + r + 1) / 2;
         if(query(vector<int>(order.begin(), order.begin() + mid))) r = mid - 1; 
         else l = mid; 
     }
     return order[l]; 
}
signed main(void)
{
    return 0; 
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:12:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |      for(int i = 0; i < adj[u].size(); i++)
      |                     ~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cckDAD0J.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccvm092J.o:eastereggs.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cckDAD0J.o: in function `main':
grader.cpp:(.text.startup+0x1e6): undefined reference to `findEgg(int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >)'
collect2: error: ld returned 1 exit status