Submission #836172

#TimeUsernameProblemLanguageResultExecution timeMemory
836172DenkataArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "shoes.h"
#include "grader.cpp"
using namespace std;
const int maxn = 1e5+3;
long long i,j,ans,p;
deque <int> pos[maxn*2];
long long count_swaps(vector<int> s)
{
    ans = 0;
    j = 1;
    for(auto i:s)
    {
        if(pos[-i+maxn].empty())
            pos[i+maxn].push_back(j);
        else
        {
            p = pos[-i+maxn].front();
            pos[-i+maxn].pop_front();
            ans+=j-p-1;
            if(i<0)
                ans++;
        }
        j++;
    }
    return ans;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cck2GSyO.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccMmNbKP.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status