제출 #1171747

#제출 시각아이디문제언어결과실행 시간메모리
1171747pawelkawaA Plus B (IOI23_aplusb)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int main () {
   unsigned int n;
    cin >> n;
    vector <int> A(n), B(n), C;
    for (int i = 0; i<n; i++) {
        cin >> A[i];
    }
     for (int i = 0; i<n; i++) {
        cin >>B[i];
    }
    if (n==1) {
        cout << A[0]+B[0] << endl;
        return 0;
    }
    int i = 0, j = 0;
    while (C.size() < n) { 
        C.push_back(A[i]+B[j]);
        if (i == n-1)
        j++;
        else if (j == n-1)
        i++;
        else {
            if (A[i]+B[j+1] < A[i+1] + B[j])
            j++;
            else
            i++;
            
        }
      //  cout << i << ' ' << j << endl;
       

    }
    
    for (auto x : C)
    cout << x << ' ';
    cout << '\n';
    return 0;
    
}

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

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