Submission #1258915

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

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

Compilation message (stderr)

shoes.cpp:5:9: error: ambiguating new declaration of 'int64_t count_swaps(std::vector<int>)'
    5 | int64_t count_swaps(vector<int> a) {
      |         ^~~~~~~~~~~
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);
      |           ^~~~~~~~~~~