Submission #303561

#TimeUsernameProblemLanguageResultExecution timeMemory
303561vipghn2003Arranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "shoes.h"
using namespace std;

const int N=1e5+5;

int count_swaps(vector<int>a)
{
    int n=a.size();
    int res=0;
    for(int i=0;i<n;i+=2)
    {
        int id;
        for(int j=2;j<=n;j++)
        {
            if(a[j]==-a[i])
            {
                id=j;
                break;
            }
        }
        for(int j=id;j>i+1;j--)
        {
            res++;
            swap(a[j],a[j-1]);
        }
        if(a[i]>0) res++;
    }
    return res;
}

Compilation message (stderr)

shoes.cpp:7:5: error: ambiguating new declaration of 'int count_swaps(std::vector<int>)'
    7 | int count_swaps(vector<int>a)
      |     ^~~~~~~~~~~
In file included from shoes.cpp:2:
shoes.h:7:11: note: old declaration 'long long int count_swaps(std::vector<int>)'
    7 | long long count_swaps(std::vector<int> S);
      |           ^~~~~~~~~~~