Submission #921795

#TimeUsernameProblemLanguageResultExecution timeMemory
921795NurislamArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define int long long #define order_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> long long count_swaps(std::vector<int> a) { int n = a.size(); int la[n*2]{}; int b[n+1]{}; for(int i = n*2-1; i >= 0; i--){ if(b[abs(a[i])] == 0)b[abs(a[i])] = i; else{ la[i] = b[abs(a[i])]; b[abs(a[i])] = 0; } } order_set st; int ans = 0, us[n*2]{}; for(int i = 0; i < n*2; i++){ if(us[i]){ st.erase(i); continue; } int r = st.order_of_key(la[i]); ans += la[i]-i-1-r; st.insert(la[i]); us[la[i]]++; } int us2[n+1]{}; for(int i = 0; i < n*2; i++){ if(us2[i])continue; us2[la[i]]++; ans += (a[i] > 0); } return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccpAeFQ9.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