답안 #483620

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
483620 2021-10-31T09:34:34 Z alexdumitru Easter Eggs (info1cup17_eastereggs) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
int findEgg(int N, vector<pair<int,int> > bridges);
{
    int st=0,dr=N-1,rasp=-1,mi,viz[550],i,m=bridges.size(),nr=1;
    for(i=1;i<=N;i++)viz[i]=0;
    vector<int> v[550];
    vector<int> parcurgere;
    for(i=0;i<m;i++)
    {
        v[bridges[i].first].push_back(bridges[i].second);
        v[bridges[i].second].push_back(bridges[i].first);
    }
    parcurgere.push_back(1);
    dfs(1);
    while(st<=dr)
    {
        mi=st+(dr-st)/2;
        vector<int> q;
        for(i=0;i<=mi;i++)q.push_back(i);
        if(query(q))
        {
            dr=mi-1;
            rasp=mi;
        }
        else st=mi+1;
    }
    if(rasp==-1)return N;
    return rasp;
}
void dfs(int nod)
{
    int k=v[nod].size();
    for(int i=0;i<k;i++)
    {
        if(!viz[v[nod][i]])
        {
            viz[v[nod][i]]=1;
            parcurgere.push_back(v[nod][i]);
            dfs(v[nod][i]);
        }
    }
}
int query(vector<int> islands);

Compilation message

eastereggs.cpp:4:1: error: expected unqualified-id before '{' token
    4 | {
      | ^
eastereggs.cpp: In function 'void dfs(int)':
eastereggs.cpp:33:11: error: 'v' was not declared in this scope
   33 |     int k=v[nod].size();
      |           ^
eastereggs.cpp:36:13: error: 'viz' was not declared in this scope
   36 |         if(!viz[v[nod][i]])
      |             ^~~
eastereggs.cpp:39:13: error: 'parcurgere' was not declared in this scope
   39 |             parcurgere.push_back(v[nod][i]);
      |             ^~~~~~~~~~