제출 #715758

#제출 시각아이디문제언어결과실행 시간메모리
715758aykhn동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define OPT ios_base::sync_with_stdio(0); \
            cin.tie(0); \
            cout.tie(0)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define pull pair<ull,ull>
#define endl "\n"
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) \
                    cout << v[i] << " "; \
                    cout<<endl;

void solve(int n, vector<int> b)
{
    vector<int> ans(n, -1);

    for (int i = 0; i < n; i++)
    {
        b[i] = 1;
        int x = tryCombination(b);
        ans[i] = x;
        b[i] = 0;
    }

    for (int i = 0; i < n; i++) b[i] = 0;

    answer(b, ans);
}

void exploreCave(int n)
{
    vector<int> b;
    for (int i = 0; i < n; i++) b.pb(0);

    int ans = tryCombination(b);

    if (ans == -1)
    {
        solve(n, b);
    }
}

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void solve(int, std::vector<int>)':
cave.cpp:36:32: error: cannot convert 'std::vector<int>' to 'int*'
   36 |         int x = tryCombination(b);
      |                                ^
      |                                |
      |                                std::vector<int>
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:43:12: error: cannot convert 'std::vector<int>' to 'int*'
   43 |     answer(b, ans);
      |            ^
      |            |
      |            std::vector<int>
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:51:30: error: cannot convert 'std::vector<int>' to 'int*'
   51 |     int ans = tryCombination(b);
      |                              ^
      |                              |
      |                              std::vector<int>
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~