제출 #285664

#제출 시각아이디문제언어결과실행 시간메모리
285664Otaku619Arranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int vect[2 * n];
    for (int i = 0; i < 2 * n; i++)
        cin >> vect[i];
    int swa = 0;
    for (int i = 0; i < 2 * n; i += 2)
    {
        for (int j = i + 1; j < 2 * n; j++)
        {
            if (abs(vect[j]) == abs(vect[i]))
            {
                for (int k = j; k > i + 1; k--)
                    swap(vect[k], vect[k - 1]);
                swa += (j - 1 - i);
                if (vect[i + 1] < 0)
                {
                    swap(vect[i], vect[i + 1]);
                    swa++;
                }
                break;
            }
        }
    }
    cout << swa;
    return 0;
}

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

/tmp/ccAFN1jF.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccz0BSC6.o:shoes.cpp:(.text.startup+0x0): first defined here
/tmp/ccAFN1jF.o: In function `main':
grader.cpp:(.text.startup+0x26a): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status