This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Code for problem A by cookiedoth
Generated 28 Aug 2020 at 01.11 PM
______▄███████▄_______
______█▄█████▄█_______
______█▼▼▼▼▼█_______
_____██________ ██______
______█▲▲▲▲▲█_______
______█████████_______
_______██____ ██________
=_=
¯\_(ツ)_/¯
o_O
*/
#include "shoes.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
#include <random>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define debug(a) cerr << #a << " = " << a << endl
#define forn(i, n) for (int i = 0; i < n; ++i)
#define length(a) (int)a.size()
using namespace std;
template<class T> int chkmax(T &a, T b) {
	if (b > a) {
		a = b;
		return 1;
	}
	return 0;
}
template<class T> int chkmin(T &a, T b) {
	if (b < a) {
		a = b;
		return 1;
	}
	return 0;
}
template<class iterator> void output(iterator begin, iterator end, ostream& out = cerr) {
	while (begin != end) {
		out << (*begin) << " ";
		begin++;
	}
	out << endl;
}
template<class T> void output(T x, ostream& out = cerr) {
	output(x.begin(), x.end(), out);
}
void fast_io() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
const int INF = 1e9 + 228;
map<vector<int>, int> dp;
ll count_swaps(vector<int> s) {
	queue<vector<int> > q;
	q.push(s);
	dp[s] = 0;
	while (!q.empty()) {
		vector<int> v = q.front();
		int cur_d = dp[v];
		q.pop();
		int ok = 1;
		for (int i = 0; i < (int)v.size(); i += 2) {
			if (v[i] + v[i + 1] != 0 || v[i] > v[i + 1]) {
				ok = 0;
				break;
			}
		}
		if (ok) {
			return dp[v];
		}
		for (int i = 0; i < (int)v.size() - 1; ++i) {
			swap(v[i], v[i + 1]);
			if (dp.find(v) == dp.end()) {
				dp[v] = cur_d + 1;
				q.push(v);
			}
			swap(v[i], v[i + 1]);
		}
	}
}
Compilation message (stderr)
shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:95:22: warning: control reaches end of non-void function [-Wreturn-type]
   95 |  queue<vector<int> > q;
      |                      ^| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |