Submission #1224860

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

typedef long long int64;

int64 count_swaps(int S[], int n) {
    vector<bool> used(n, false);
    int64 swaps = 0;

    for (int i = 0; i < n; i++) {
        if (used[i]) continue;

        if (S[i] < 0) {
            for (int j = i + 1; j < n; j++) {
                if (!used[j] && S[j] == -S[i]) {
                    for (int k = j; k > i + 1; k--) {
                        swap(S[k], S[k - 1]);
                        swaps++;
                    }
                    used[i] = true;
                    used[i + 1] = true;
                    break;
                }
            }
        }
    }

    return swaps;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccLA57Eb.o: in function `main':
grader.cpp:(.text.startup+0x289): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status