제출 #1291883

#제출 시각아이디문제언어결과실행 시간메모리
1291883lukaye_19Arranging Shoes (IOI19_shoes)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n; cin >> n;
    bool samesize = true;
    bool leftrightshoes = true;
    
    vector<int>shoes(n * 2);
    
    for (int i = 0; i < n; i++) 
    {
        int a; cin >> a;
        
        if (a != shoes[i - 1]) samesize = false;
        if ((i <= n - 1 && a > 0) || (i > n - 1 && i <= n * 2 - 1 && a < 0)) leftrightshoes = false;
        
        shoes[i] = a;
    }
    
    if (n == 1)
    {
        if (shoes[0] > shoes[1])
        {
            cout << 1 << endl;
        }
        else
        {
            cout << 0 << endl;
        }
    }
    else if (samesize)
    {
        int answer = 0;
        
        for (int i = 0; i < n * 2; i += 2)
        {
            if (i % 2 == 0 && shoes[i] > 0)
            {
                answer++;
            }
        }
        
        cout << answer;
    }
    else if (leftrightshoes)
    {
        int answer = 0;
        
        for (int i = 0; i < n; i++)
        {
            answer += i;
        }
        
        cout << answer;
    }
}

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

/usr/bin/ld: /tmp/ccP3zKWP.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccBdeGN7.o:shoes.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccP3zKWP.o: in function `main':
grader.cpp:(.text.startup+0x26b): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status