Submission #227692

#TimeUsernameProblemLanguageResultExecution timeMemory
227692Romario8Arranging 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; } int main() { int n;cin>>n; vector<ll> s; rep(i,0,2*n) { ll a;cin>>a; s.pb(a); } cout<<count_swaps(s); }

Compilation message (stderr)

/tmp/ccIf56kA.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccBRrNAf.o:shoes.cpp:(.text.startup+0x0): first defined here
/tmp/ccIf56kA.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