Submission #289934

#TimeUsernameProblemLanguageResultExecution timeMemory
289934MarcoMeijerArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "shoes.h" #include "grader.cpp" using namespace std; //macros typedef long long ll; typedef pair<int, int> ii; typedef pair<ll, ll> lll; typedef tuple<int, int, int> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<ll> vll; typedef vector<lll> vlll; #define REP(a,b,c) for(int a=int(b); a<int(c); a++) #define RE(a,c) REP(a,0,c) #define RE1(a,c) REP(a,1,c+1) #define REI(a,b,c) REP(a,b,c+1) #define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--) #define INF 1e9 #define pb push_back #define fi first #define se second const int MX = 1e5; int n=0; ll ans=0; map<int,queue<int>> last; int ft[MX]; void addFT(int i, int v) { for(i++; i<=n; i+=i&-i) ft[i]+=v; } int getFT(int i) { int res = 0; for(i++; i; i-=i&-i) res += ft[i]; return res; } ll count_swaps(vi s) { n = s.size(); RE(i,n+2) ft[i] = 0; RE(i,n) addFT(i+1,1); RE(i,n) { if(!last[-s[i]].empty()) { int j = last[-s[i]].front(); last[-s[i]].pop(); if(s[i] > 0) { ans += getFT(j); addFT(j,-1); ans += getFT(i); addFT(i,-1); } else { ans += getFT(i); addFT(i,-1); ans += getFT(j); addFT(j,-1); } } else { last[s[i]].push(i); } } return ans; }

Compilation message (stderr)

/tmp/cc4trOSB.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cceT2svG.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status