Submission #1204049

#TimeUsernameProblemLanguageResultExecution timeMemory
1204049arkanefuryArranging Shoes (IOI19_shoes)C++20
Compilation error
0 ms0 KiB
#include "shoes.h"
using namespace std;
const int N = 2e5+5;
int a[N], b[N];
int count_swaps(vector <int> v){
    int n = v.size();
    for(int i = 0; i < n; i ++){
        if(v[i] > 0)a[v[i]] = i;
        else b[v[i] * -1] = i;
    }
    int ans = 0, x = 0;
    for(int i = 1; i <= n/2; i ++){
        ans += a[i] - x + b[i] - x - 1;
        x += 2;
    }
    return ans;
}

Compilation message (stderr)

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