제출 #97968

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

using namespace std;

/*
void answer(int S[], int D[]){

}
*/
/*
int tryCombination(int S[]){

}
*/

void voidexploreCave(int n) {
  int *door[n] = {0}, *per[n] = {0}, *seen[n] = {0};

  for(int i = 0; i < n; i++){
    int from = 0, to = n - 1;
    if(i < tryCombination(door))
      for(int j = 0; j < n; j++)
        if(seen[j] == 0)
          door[j] ^= 1;

    while(from < to){
      int mid = (from + to + 1) / 2;
      for(int j = 0; j < mid; j++)
        if(seen[j] == 0)
          door[j] ^= 1;
      if(i < tryCombination(door)){
        to = mid - 1;
      } else
        from = mid;
      for(int j = 0; j < mid; j++)
        if(seen[j] == 0)
          door[j] ^= 1;
    }
    per[from] = i;
    seen[from] = 1;
  }
  answer(door, per);
}

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

cave.cpp: In function 'void voidexploreCave(int)':
cave.cpp:22:31: error: cannot convert 'int**' to 'int*' for argument '1' to 'int tryCombination(int*)'
     if(i < tryCombination(door))
                               ^
cave.cpp:25:19: error: invalid operands of types 'int*' and 'int' to binary 'operator^'
           door[j] ^= 1;
           ~~~~~~~~^~~~
cave.cpp:25:22: error:   in evaluation of 'operator^=(int*, int)'
           door[j] ^= 1;
                      ^
cave.cpp:31:19: error: invalid operands of types 'int*' and 'int' to binary 'operator^'
           door[j] ^= 1;
           ~~~~~~~~^~~~
cave.cpp:31:22: error:   in evaluation of 'operator^=(int*, int)'
           door[j] ^= 1;
                      ^
cave.cpp:32:33: error: cannot convert 'int**' to 'int*' for argument '1' to 'int tryCombination(int*)'
       if(i < tryCombination(door)){
                                 ^
cave.cpp:38:19: error: invalid operands of types 'int*' and 'int' to binary 'operator^'
           door[j] ^= 1;
           ~~~~~~~~^~~~
cave.cpp:38:22: error:   in evaluation of 'operator^=(int*, int)'
           door[j] ^= 1;
                      ^
cave.cpp:40:17: error: invalid conversion from 'int' to 'int*' [-fpermissive]
     per[from] = i;
                 ^
cave.cpp:41:18: error: invalid conversion from 'int' to 'int*' [-fpermissive]
     seen[from] = 1;
                  ^
cave.cpp:43:19: error: cannot convert 'int**' to 'int*' for argument '1' to 'void answer(int*, int*)'
   answer(door, per);
                   ^