제출 #146776

#제출 시각아이디문제언어결과실행 시간메모리
146776youssan_williamArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "shoes.h"
using namespace std;
typedef long long ll;
bool v[100005];
ll count_swaps( vector<ll>s )
{
    ll n = s.size()/2 ;
    ll ans=0;
    for(int i = 1 ; i <=2*n ; i++)
    {
        if(!v[abs(s[i])])
        {
            v[abs(s[i])]=1;
            for(int j =i+1 ; j <= 2 * n ;j++)
            {
                if(abs(s[i])==abs(s[j]))
                {
                    for(int k=j-1 ; k>i ;k--)
                    {
                        swap(s[k],s[k+1]);
                        ans++;
                    }
                    break;
                }
            }
        }
    }
    for(int i = 1 ;  i <=2*n ;i++ )
    {
        if(i%2==1&&s[i]>s[i+1])
            ans++;
    }
    return ans;
}

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

/tmp/ccdsAamr.o: In function `main':
grader.cpp:(.text.startup+0x272): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status