답안 #120949

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
120949 2019-06-25T19:56:31 Z Rahul 코알라 (APIO17_koala) C++17
컴파일 오류
0 ms 0 KB
#include "koala.h"
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()

int B[500], R[500];
int minValue(int n, int w) {
  for (int i = 0; i < 100; ++i) {
    B[i] = i < 51;
  }
  playRound(B, R);
  int m = -1;
  for (int i = 0; i < 51; ++i) {
    if (R[i] == 0) {
      m = i;
    } else assert (R[i] == 2);
  }
  for (int i = 0; i < 100; ++i) {
    B[i] = i >= 50;
  }
  B[m] = 1;
  if (m == 50) B[49] = 1;
  playRound(B, R);
  int res = -1;
  for (int i = 50; i < 100; ++i) {
    if (R[i] == 0) {
      res = i;
    } else assert (R[i] == 2);
  }
  if (res != -1) return res;
  if (m == 50) return 49;
  else return m;
}
int maxValue(int n, int w) {
  return 0;
}
int greaterValue(int n, int w) {
  return 0;
}
int allValues(int n, int w, int *P) {
  return 0;
}

Compilation message

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:16:12: error: 'assert' was not declared in this scope
     } else assert (R[i] == 2);
            ^~~~~~
koala.cpp:16:12: note: suggested alternative: 'short'
     } else assert (R[i] == 2);
            ^~~~~~
            short
koala.cpp:28:12: error: 'assert' was not declared in this scope
     } else assert (R[i] == 2);
            ^~~~~~
koala.cpp:28:12: note: suggested alternative: 'short'
     } else assert (R[i] == 2);
            ^~~~~~
            short
koala.cpp: In function 'int allValues(int, int, int*)':
koala.cpp:40:5: error: ambiguating new declaration of 'int allValues(int, int, int*)'
 int allValues(int n, int w, int *P) {
     ^~~~~~~~~
In file included from koala.cpp:1:0:
koala.h:9:6: note: old declaration 'void allValues(int, int, int*)'
 void allValues(int N, int W, int *P);
      ^~~~~~~~~