답안 #881706

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

using namespace std;

int A[100005];
int B[100005];

int main() {
  int n;
  
  cin >> n;
  for (int i = 0 ;i < n; ++i) {
    cin >> A[i];
  }
  for (int i = 0 ;i < n; ++i) {
    cin >> B[i];
  }
  vector<int> ans;
  int ans_n = 0;
  int i = 0, j = 0;
  while (ans_n < n) {
    ans.push_back(A[i] + B[j]);
    ans_n++;
    if (A[i] + B[j+1] < A[i+1] + B[j]) {
      ++j;
    } else {
      ++i;
    }
  }
  for (int c : ans) {
    cout << c << " ";
  }
  cout << "\n";
  return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccriT2mg.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWQ2i0e.o:aplusb.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccriT2mg.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