#include <bits/stdc++.h>
using namespace std;
int count_swaps(vector<int>shoes)
{
int n = shoes.size() / 2;
bool leftrightshoes = true;
for (int i = 0; i < n * 2; i++)
{
int a = shoes[i];
if ((i <= n - 1 && a > 0) || (i > n - 1 && i <= n * 2 - 1 && a < 0)) leftrightshoes = false;
shoes[i] = a;
}
if (n == 1)
{
if (shoes[0] > shoes[1])
{
return 1;
}
else
{
return 0;
}
}
int answer = (n * (n - 1)) / 2;
return answer;
}
| # | 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... |