Submission #713465

#TimeUsernameProblemLanguageResultExecution timeMemory
713465europiumArranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include<iterator>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_set>
using namespace std;

using ll = long long;

ll count_swaps(vector<ll> a) {
	ll n = a.size();
	ll ans = 0;

	vector<bool> used(n);

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

		ll j = i + 1;
		ll val = 0;

		while (a[j] != -a[i]){
			if (!used[j]) val++;
			j++;
		}

		if (a[i] > 0) ans += val + 1;
		else ans += val;

		used[i] = true;
		used[j] = true;
	}

	return ans;
}

Compilation message (stderr)

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