제출 #881707

#제출 시각아이디문제언어결과실행 시간메모리
881707spdlingA Plus B (IOI23_aplusb)C++17
컴파일 에러
0 ms0 KiB


int[] smallest_sums(int N, int[] A, int[] B) {

  int* ans = new int[N]();
  int ans_n = 0;
  int i = 0, j = 0;
  while (ans_n < N) {
    ans[ans_n] = A[i] + B[j];
    ans_n++;
    if (A[i] + B[j+1] < A[i+1] + B[j]) {
      ++j;
    } else {
      ++i;
    }
  }

  return ans;
}

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

aplusb.cpp:3:4: error: structured binding declaration cannot have type 'int'
    3 | int[] smallest_sums(int N, int[] A, int[] B) {
      |    ^~
aplusb.cpp:3:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
aplusb.cpp:3:4: error: empty structured binding declaration
aplusb.cpp:3:7: error: expected initializer before 'smallest_sums'
    3 | int[] smallest_sums(int N, int[] A, int[] B) {
      |       ^~~~~~~~~~~~~