This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "swaps.h"
#include <vector>
using namespace std;
int arj[505];
void solve(int N, int V) {
for (int i = 1; i <= N; i++)
{
arj[i] = i;
}
for (int i = 0; i < V; i++)
{
if (i % 2)
{
for (int j = 1; j < N; j += 2)
{
schedule(arj[j], arj[j + 1]);
}
}
else
{
for (int j = 2; j < N; j += 2)
{
schedule(arj[j], arj[j + 1]);
}
schedule(arj[1], arj[N]);
}
vector<int> visa = visit();
if (i % 2)
{
for (int j = 1; j < N; j += 2)
{
if (visa[j / 2] == 0)
{
swap(arj[j], arj[j + 1]);
}
}
}
else
{
for (int j = 2; j < N; j += 2)
{
if (visa[j / 2 - 1] == 0)
{
swap(arj[j], arj[j + 1]);
}
}
if (visa.back() == 0)
{
swap(arj[1], arj[N]);
}
}
}
vector<int> v;
for (int i = 1; i <= N; i++)
{
v.push_back(arj[i]);
}
answer(v);
}
# | 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... |
# | 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... |