제출 #694853

#제출 시각아이디문제언어결과실행 시간메모리
694853allin27xArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;
ll count_swaps(vector<ll> S){
    ll res = 0;
    ll n = S.size();
    vector<ll> s(n,0);
    vector<bool> ac(n,1);
    for (ll i=0; i<n; i++){
        if (!ac[i]) continue;
        for (ll j=i+1; j<n; j++){
            if (!ac[j] || abs(S[j])!=abs(S[i])) continue;
            ac[j] = 0;
            ac[i] = 0;
            if (S[i]<0) res+=j-i-1; else res+=j-i; break;
        }
    }
    return res;
}

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

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