답안 #918021

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
918021 2024-01-29T12:19:39 Z Elwino008 Easter Eggs (info1cup17_eastereggs) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

#define endl '\n'
#define pii pair<int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
//#define int ll
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define M_PI 3.14159265358979323846
#define all(v) v.begin(), v.end()
#define pss pair<string, string>
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
#define imp cout<<-1<<endl;
#define flu cout.flush();

int n, used[555];
vector<int>nodes;

void dfs(int node, vector<int>a[555]){
    used[node]=1;
    nodes.pb(node);
    for(int i : a[node]){
        if(used[i]==0){
            dfs(i);
        }
    }
}

int findEgg (int N, vector < pair < int, int > > bridges)
{
    dfs(1, bridges);
    n=N;
    int l=1, r=n;
    while(l<=r){
        int mid=(l+r)/2;
        vector<int>v;
        for(int i=l; i<=mid; i++){
            v.pb(i);
        }
        int ans;
        ans=query(v);
        if(ans==1){
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return r+1;
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, std::vector<int>*)':
eastereggs.cpp:30:18: error: too few arguments to function 'void dfs(int, std::vector<int>*)'
   30 |             dfs(i);
      |                  ^
eastereggs.cpp:25:6: note: declared here
   25 | void dfs(int node, vector<int>a[555]){
      |      ^~~
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:37:12: error: cannot convert 'std::vector<std::pair<int, int> >' to 'std::vector<int>*'
   37 |     dfs(1, bridges);
      |            ^~~~~~~
      |            |
      |            std::vector<std::pair<int, int> >
eastereggs.cpp:25:31: note:   initializing argument 2 of 'void dfs(int, std::vector<int>*)'
   25 | void dfs(int node, vector<int>a[555]){
      |                    ~~~~~~~~~~~^~~~~~