제출 #1019466

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

ll count_swaps(vector<ll> S) {
    ll n = S.size(), ans = 0LL;
    unordered_map<ll,vector<ll>> M;
    for(ll i = 0; i < n; i++) {
        if(M[S[i]].size()) {
            ans += (ll)i-M[S[i]].back();
            if(S[i]>0LL) ans -= 1LL;
            M[S[i]].pop_back();
        }
        else {
            M[-S[i]].push_back(i);
        }
    }
    return ans;
}

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

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