Submission #1224866

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

int64 count_swaps(vector<int> S) {
    int n = S.size();
    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)

shoes.cpp:5:1: error: 'int64' does not name a type; did you mean 'int64_t'?
    5 | int64 count_swaps(vector<int> S) {
      | ^~~~~
      | int64_t