Submission #1215784

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

long long count_swapsmy(std::vector<int> s) {
	vector<int> h;
	for(ll i=0; i<s.size(); i++)
	{
		if(s[i]<0)
		{
			h.push_back(s[i]);
		}
	}
	sort(h.begin(),h.end());
	
	ll cmin=LLONG_MAX;
	do
	{   
		vector<int> h2;
		for(ll i=0; i<h.size(); i++)
		{
			h2.push_back(h[i]);
			h2.push_back(-h[i]);
		}
		ll c=0;
		for(ll i=0; i<s.size(); i++)
		{
		for(ll j=h2.size()-1; j>i; j--)
		{
			if(s[i]==h2[j]){swap(h2[j], h2[j-1]);c++;}
		}
		}
		cmin=min(cmin,c);
	} while((next_permutation(s.begin(),s.end())));
	return cmin;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccVJ0aeG.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