제출 #1231884

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

void subtask1(int);
void subtask2(int);
void subtask3(int);

void exploreCave(int N)
{
    subtask1(N);
}

void subtask1(int N)
{
    vector<int> D(N);
    iota(D.begin(), D.end(), 1);
    vector<int> S(N, 0);
    int knowAt = 0;
    while (knowAt < N)
    {
        S[knowAt] ^= 1;
        int res = tryCombination(S);
        if (res == -1)
            answer(S, D);

        knowAt = res;
    }
}
void subtask2(int N)
{
    vector<int> S(N, 0);
    vector<int> D(N);
    for (int switchId = 0; switchId < N; switchId++)
    {
        S[switchId] = 1;
        int res = tryCombination(S);
        D[switchId] = res;
        S[switchId] = 0;
    }
    answer(S, D);
}

void subtask3(int N)
{
    // pass
}

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

cave.cpp: In function 'void subtask1(int)':
cave.cpp:23:34: error: cannot convert 'std::vector<int>' to 'int*'
   23 |         int res = tryCombination(S);
      |                                  ^
      |                                  |
      |                                  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:25:20: error: cannot convert 'std::vector<int>' to 'int*'
   25 |             answer(S, D);
      |                    ^
      |                    |
      |                    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 subtask2(int)':
cave.cpp:37:34: error: cannot convert 'std::vector<int>' to 'int*'
   37 |         int res = tryCombination(S);
      |                                  ^
      |                                  |
      |                                  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:41:12: error: cannot convert 'std::vector<int>' to 'int*'
   41 |     answer(S, D);
      |            ^
      |            |
      |            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[]);
      |             ~~~~^~~