제출 #844176

#제출 시각아이디문제언어결과실행 시간메모리
844176matanA Plus B (IOI23_aplusb)C++17
컴파일 에러
0 ms0 KiB
std::vector<long long> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {
  std::vector<long long> 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;
}

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

aplusb.cpp:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<long long> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {
      |      ^~~~~~
aplusb.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | std::vector<long long> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {