Submission #1019466

#TimeUsernameProblemLanguageResultExecution timeMemory
1019466NicolaikrobArranging Shoes (IOI19_shoes)C++17
Compilation error
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;
}

Compilation message (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