답안 #881708

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881708 2023-12-01T18:50:34 Z spdling A Plus B (IOI23_aplusb) C++17
컴파일 오류
0 ms 0 KB

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;
}

Compilation message

aplusb.cpp:3:33: error: expected ',' or '...' before 'A'
    3 | int* smallest_sums(int N, int[] A, int[] B) {
      |                                 ^
aplusb.cpp: In function 'int* smallest_sums(int, int*)':
aplusb.cpp:9:18: error: 'A' was not declared in this scope
    9 |     ans[ans_n] = A[i] + B[j];
      |                  ^
aplusb.cpp:9:25: error: 'B' was not declared in this scope
    9 |     ans[ans_n] = A[i] + B[j];
      |                         ^