Submission #227691

#TimeUsernameProblemLanguageResultExecution timeMemory
227691Romario8Arranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h" #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(ll i=a;i<b;i++) #define rrep(i,a,b) for(ll i=a;i>=b;i--) #define pb push_back #define rl "\n" #define x first #define y second using namespace std; long long count_swaps(vector<ll> s) { ll ans=0; ll n=s.size(); vector<vector<ll>> pr(2*n+1); rep(i,0,n) { pr[s[i]+n].pb(i); if(pr[-s[i]+n].size()!=0) { ans+=i-pr[-s[i]+n][0]; if(s[i]>0)ans--; pr[-s[i]+n].erase(pr[-s[i]+n].begin()); pr[s[i]+n].erase(pr[s[i]+n].begin()); } } return ans; }

Compilation message (stderr)

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