| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1291885 | lukaye_19 | Arranging Shoes (IOI19_shoes) | C++20 | 1 ms | 408 KiB |
#include <bits/stdc++.h>
using namespace std;
int count_swaps(vector <int> shoes)
{
int n=shoes.size();
bool samesize = true;
bool leftrightshoes = true;
for (int i = 0; i < n; i++)
{
int a=shoes[i];
if (i != 0)
{
if (abs(a) != abs(shoes[i - 1])) samesize = false;
}
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])
{
cout << 1 << endl;
}
else
{
cout << 0 << endl;
}
}
else if (samesize)
{
int answer = 0;
for (int i = 0; i < shoes.size(); i += 2)
{
if (i % 2 == 0 && shoes[i] > 0)
{
answer++;
}
}
cout << answer;
}
else if (leftrightshoes)
{
int answer = 0;
for (int i = 0; i < n; i++)
{
answer += i;
}
return answer;
}
}
Compilation message (stderr)
| # | 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... | ||||
