제출 #432074

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

int tryCombination(int S[]);

void answer(int S[], int D[]);

void exploreCave(int N) {
    int combination[N];
    for (int i = 0; i < N; i++)
        combination[i] = 0;

    if (tryCombination(combination) == -1) {
        int position[N];
        for (int i = 0; i < N; i++) {
            combination[i] = 1;
            answer[i] = tryCombination(combination);
            combination[i] = 0;
        }

        answer(combination, position);
    }
}

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   18 |             answer[i] = tryCombination(combination);
      |                     ^
cave.cpp:18:23: error: assignment of read-only location '*(answer + ((sizetype)i))'
   18 |             answer[i] = tryCombination(combination);
      |             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~