답안 #844183

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844183 2023-09-05T10:50:36 Z matan A Plus B (IOI23_aplusb) C++17
컴파일 오류
0 ms 0 KB
#include "aplusb.h"
#include <vector>
#include <algorithm>
 
std::vector<int> smallest_sums_efficient(int N, std::vector<int> A, std::vector<int> B) {
  std::vector<int> C(N);
  std::vector<int> CC_index(N, 0);
  C[0] = A[0] + B[0];
  CC_index[0]++;
  int k = 1;
  while (k < N) {
    std::vector<int> temp_vector;
    for (int l = 0; l < N; l++) {
      temp_vector.push_back(A[l] + B[CC_index[l]]);
    }
    auto min_it = std::min_element(temp_vector.begin(), temp_vector.end());
    int min_val = *min_it;
    int min_idx = (int)std::distance(temp_vector.begin(), min_it);
    C[k] = min_val;
    k++;
    CC_index[min_idx]++;
  }
 
  return C;
}

Compilation message

/usr/bin/ld: /tmp/ccHGByqV.o: in function `main':
grader.cpp:(.text.startup+0x271): undefined reference to `smallest_sums(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status