Submission #919993

#TimeUsernameProblemLanguageResultExecution timeMemory
919993tanprodiumArranging Shoes (IOI19_shoes)C++14
Compilation error
0 ms0 KiB
#include "shoes.h"

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

Compilation message (stderr)

shoes.cpp:3:1: error: 'll' does not name a type
    3 | ll count_swaps(vector<int> a) {
      | ^~