#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 = 0; i < N; i++)
{
v.push_back(i + 1);
}
answer(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
344 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
344 KB |
Correct |
2 |
Correct |
74 ms |
344 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
344 KB |
Correct |
2 |
Correct |
74 ms |
344 KB |
Correct |
3 |
Incorrect |
28 ms |
344 KB |
Not correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
344 KB |
Correct |
2 |
Correct |
71 ms |
344 KB |
Correct |
3 |
Correct |
157 ms |
408 KB |
Correct |
4 |
Correct |
289 ms |
1568 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
344 KB |
Correct |
2 |
Correct |
71 ms |
344 KB |
Correct |
3 |
Correct |
157 ms |
408 KB |
Correct |
4 |
Correct |
289 ms |
1568 KB |
Correct |
5 |
Incorrect |
27 ms |
344 KB |
Not correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
344 KB |
Correct |
2 |
Correct |
72 ms |
344 KB |
Correct |
3 |
Correct |
153 ms |
400 KB |
Correct |
4 |
Correct |
299 ms |
1504 KB |
Correct |
5 |
Correct |
29 ms |
1408 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
37 ms |
344 KB |
Correct |
2 |
Correct |
72 ms |
344 KB |
Correct |
3 |
Correct |
153 ms |
400 KB |
Correct |
4 |
Correct |
299 ms |
1504 KB |
Correct |
5 |
Correct |
29 ms |
1408 KB |
Correct |
6 |
Incorrect |
33 ms |
344 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
344 KB |
Correct |
2 |
Correct |
76 ms |
344 KB |
Correct |
3 |
Correct |
150 ms |
400 KB |
Correct |
4 |
Correct |
281 ms |
1596 KB |
Correct |
5 |
Correct |
28 ms |
936 KB |
Correct |
6 |
Incorrect |
7 ms |
1092 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
344 KB |
Correct |
2 |
Correct |
76 ms |
344 KB |
Correct |
3 |
Correct |
150 ms |
400 KB |
Correct |
4 |
Correct |
281 ms |
1596 KB |
Correct |
5 |
Correct |
28 ms |
936 KB |
Correct |
6 |
Incorrect |
7 ms |
1092 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
344 KB |
Correct |
2 |
Correct |
74 ms |
344 KB |
Correct |
3 |
Correct |
154 ms |
408 KB |
Correct |
4 |
Correct |
289 ms |
1312 KB |
Correct |
5 |
Correct |
29 ms |
904 KB |
Correct |
6 |
Incorrect |
6 ms |
664 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
344 KB |
Correct |
2 |
Correct |
74 ms |
344 KB |
Correct |
3 |
Correct |
154 ms |
408 KB |
Correct |
4 |
Correct |
289 ms |
1312 KB |
Correct |
5 |
Correct |
29 ms |
904 KB |
Correct |
6 |
Incorrect |
6 ms |
664 KB |
Not correct |
7 |
Halted |
0 ms |
0 KB |
- |