Submission #971527

# Submission time Handle Problem Language Result Execution time Memory
971527 2024-04-28T18:22:01 Z CyberCow The Collection Game (BOI21_swaps) C++17
50 / 100
311 ms 1884 KB
#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
1 Correct 30 ms 344 KB Correct
2 Correct 79 ms 344 KB Correct
3 Correct 163 ms 408 KB Correct
4 Correct 311 ms 1788 KB Correct
5 Correct 287 ms 1668 KB Correct
6 Correct 306 ms 1812 KB Correct
7 Correct 304 ms 1556 KB Correct
8 Correct 310 ms 1592 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 344 KB Correct
2 Correct 78 ms 344 KB Correct
3 Correct 162 ms 400 KB Correct
4 Correct 308 ms 1416 KB Correct
5 Correct 285 ms 1412 KB Correct
6 Correct 299 ms 1772 KB Correct
7 Correct 304 ms 1392 KB Correct
8 Correct 298 ms 1592 KB Correct
9 Correct 62 ms 1408 KB Correct
10 Correct 58 ms 1416 KB Correct
11 Correct 62 ms 1664 KB Correct
12 Correct 65 ms 908 KB Correct
13 Correct 60 ms 904 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 596 KB Correct
2 Correct 69 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 596 KB Correct
2 Correct 69 ms 344 KB Correct
3 Correct 34 ms 344 KB Correct
4 Correct 78 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 344 KB Correct
2 Correct 69 ms 596 KB Correct
3 Correct 161 ms 404 KB Correct
4 Correct 306 ms 1884 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 344 KB Correct
2 Correct 69 ms 596 KB Correct
3 Correct 161 ms 404 KB Correct
4 Correct 306 ms 1884 KB Correct
5 Correct 28 ms 344 KB Correct
6 Correct 77 ms 344 KB Correct
7 Correct 160 ms 408 KB Correct
8 Correct 307 ms 1488 KB Correct
9 Correct 289 ms 1352 KB Correct
10 Correct 294 ms 1620 KB Correct
11 Correct 305 ms 1864 KB Correct
12 Correct 300 ms 1744 KB Correct
13 Correct 35 ms 344 KB Correct
14 Correct 75 ms 344 KB Correct
15 Correct 168 ms 404 KB Correct
16 Correct 304 ms 1468 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 344 KB Correct
2 Correct 73 ms 344 KB Correct
3 Correct 149 ms 404 KB Correct
4 Correct 288 ms 1344 KB Correct
5 Correct 30 ms 428 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 344 KB Correct
2 Correct 73 ms 344 KB Correct
3 Correct 149 ms 404 KB Correct
4 Correct 288 ms 1344 KB Correct
5 Correct 30 ms 428 KB Correct
6 Correct 25 ms 344 KB Correct
7 Correct 71 ms 596 KB Correct
8 Correct 165 ms 400 KB Correct
9 Correct 303 ms 1664 KB Correct
10 Correct 300 ms 1520 KB Correct
11 Correct 305 ms 1744 KB Correct
12 Correct 310 ms 1724 KB Correct
13 Correct 307 ms 1288 KB Correct
14 Correct 60 ms 928 KB Correct
15 Correct 60 ms 1176 KB Correct
16 Correct 59 ms 1156 KB Correct
17 Correct 61 ms 1440 KB Correct
18 Correct 62 ms 1156 KB Correct
19 Correct 34 ms 596 KB Correct
20 Correct 74 ms 344 KB Correct
21 Correct 169 ms 400 KB Correct
22 Correct 304 ms 1308 KB Correct
23 Correct 30 ms 1416 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 344 KB Correct
2 Correct 72 ms 548 KB Correct
3 Correct 148 ms 404 KB Correct
4 Correct 290 ms 1512 KB Correct
5 Correct 28 ms 904 KB Correct
6 Incorrect 6 ms 676 KB Not correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 344 KB Correct
2 Correct 72 ms 548 KB Correct
3 Correct 148 ms 404 KB Correct
4 Correct 290 ms 1512 KB Correct
5 Correct 28 ms 904 KB Correct
6 Incorrect 6 ms 676 KB Not correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 344 KB Correct
2 Correct 72 ms 344 KB Correct
3 Correct 155 ms 404 KB Correct
4 Correct 287 ms 1616 KB Correct
5 Correct 29 ms 904 KB Correct
6 Incorrect 6 ms 608 KB Not correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 344 KB Correct
2 Correct 72 ms 344 KB Correct
3 Correct 155 ms 404 KB Correct
4 Correct 287 ms 1616 KB Correct
5 Correct 29 ms 904 KB Correct
6 Incorrect 6 ms 608 KB Not correct
7 Halted 0 ms 0 KB -