답안 #874284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
874284 2023-11-16T15:51:24 Z asli_bg Easter Eggs (info1cup17_eastereggs) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

vector<int> ord;
vector<int> adjlist[550];

void dfs(int i=1, int r=0){
    ord.push_back(i);
    for(auto komsu:adjlist[i]){
        if(komsu!=r){
            dfs(komsu,i);
        }
    }
}

int findEgg (int N, vector < pair < int, int > > bridges)
{

    for(int i=1;i<=N;i++){
        adjlist[i].clear();
    }

    ord.clear();

    for(auto el:bridges){
        int a=bridges.fi;
        int b=bridges.se;
        adjlist[a].pb(b);
        adjlist[b].pb(a);
    }

    dfs();

    int l=0;
    int r=N-1;

    while(l<(r-1)){
        int mid=r+(r-l)/2;
        if(query(vector<int>(ord.begin(),ord.begin()+mid))) r=mid;
        else l=mid; 
    }

    return ord[r];
}

Compilation message

eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:27:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'fi'
   27 |         int a=bridges.fi;
      |                       ^~
eastereggs.cpp:28:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'se'; did you mean 'size'?
   28 |         int b=bridges.se;
      |                       ^~
      |                       size
eastereggs.cpp:29:20: error: 'class std::vector<int>' has no member named 'pb'
   29 |         adjlist[a].pb(b);
      |                    ^~
eastereggs.cpp:30:20: error: 'class std::vector<int>' has no member named 'pb'
   30 |         adjlist[b].pb(a);
      |                    ^~