Submission #444325

# Submission time Handle Problem Language Result Execution time Memory
444325 2021-07-13T15:27:24 Z blue The Collection Game (BOI21_swaps) C++17
50 / 100
67 ms 508 KB
#include "swaps.h"
#include <vector>
using namespace std;

int N;
int V;


void solve(int n, int v1)
{
    N = n;
    V = v1;
    vector<int> r(N);
    for(int i = 1; i <= N; i++) r[i - 1] = i;

    for(int v = 1; v <= min(V, N); v++)
    {
        if(v % 2 == 0)
        {
            for(int i = 0; i+1 < N; i += 2) schedule(r[i], r[i+1]);
            vector<int> C = visit();

            for(int i = 0; i+1 < N; i += 2)
                if(C[i/2] == 0)
                    swap(r[i+1], r[i]);
        }
        else
        {
            for(int i = 1; i+1 < N; i += 2) schedule(r[i], r[i+1]);
            vector<int> C = visit();

            for(int i = 1; i+1 < N; i += 2)
                if(C[i/2] == 0)
                    swap(r[i+1], r[i]);
        }
    }

    answer(r);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 3 ms 312 KB Correct
3 Correct 14 ms 200 KB Correct
4 Correct 61 ms 284 KB Correct
5 Correct 61 ms 284 KB Correct
6 Correct 49 ms 280 KB Correct
7 Correct 50 ms 284 KB Correct
8 Correct 50 ms 284 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 2 ms 200 KB Correct
3 Correct 20 ms 260 KB Correct
4 Correct 57 ms 284 KB Correct
5 Correct 50 ms 280 KB Correct
6 Correct 60 ms 280 KB Correct
7 Correct 55 ms 280 KB Correct
8 Correct 50 ms 280 KB Correct
9 Correct 46 ms 284 KB Correct
10 Correct 63 ms 452 KB Correct
11 Correct 50 ms 300 KB Correct
12 Correct 48 ms 280 KB Correct
13 Correct 48 ms 280 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 3 ms 200 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 3 ms 200 KB Correct
3 Correct 0 ms 200 KB Correct
4 Correct 4 ms 200 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 5 ms 200 KB Correct
3 Correct 16 ms 260 KB Correct
4 Correct 64 ms 280 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 5 ms 200 KB Correct
3 Correct 16 ms 260 KB Correct
4 Correct 64 ms 280 KB Correct
5 Correct 1 ms 200 KB Correct
6 Correct 3 ms 200 KB Correct
7 Correct 13 ms 268 KB Correct
8 Correct 44 ms 280 KB Correct
9 Correct 49 ms 280 KB Correct
10 Correct 52 ms 364 KB Correct
11 Correct 57 ms 280 KB Correct
12 Correct 50 ms 284 KB Correct
13 Correct 0 ms 200 KB Correct
14 Correct 3 ms 200 KB Correct
15 Correct 16 ms 200 KB Correct
16 Correct 62 ms 288 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 3 ms 200 KB Correct
3 Correct 14 ms 200 KB Correct
4 Correct 51 ms 376 KB Correct
5 Correct 49 ms 288 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 3 ms 200 KB Correct
3 Correct 14 ms 200 KB Correct
4 Correct 51 ms 376 KB Correct
5 Correct 49 ms 288 KB Correct
6 Correct 0 ms 200 KB Correct
7 Correct 4 ms 200 KB Correct
8 Correct 16 ms 256 KB Correct
9 Correct 48 ms 324 KB Correct
10 Correct 53 ms 284 KB Correct
11 Correct 52 ms 284 KB Correct
12 Correct 56 ms 284 KB Correct
13 Correct 52 ms 396 KB Correct
14 Correct 66 ms 416 KB Correct
15 Correct 55 ms 396 KB Correct
16 Correct 51 ms 288 KB Correct
17 Correct 65 ms 508 KB Correct
18 Correct 50 ms 304 KB Correct
19 Correct 0 ms 200 KB Correct
20 Correct 3 ms 200 KB Correct
21 Correct 17 ms 260 KB Correct
22 Correct 67 ms 388 KB Correct
23 Correct 50 ms 284 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 3 ms 200 KB Correct
3 Correct 17 ms 200 KB Correct
4 Correct 50 ms 388 KB Correct
5 Correct 48 ms 332 KB Correct
6 Incorrect 10 ms 268 KB Not correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 3 ms 200 KB Correct
3 Correct 17 ms 200 KB Correct
4 Correct 50 ms 388 KB Correct
5 Correct 48 ms 332 KB Correct
6 Incorrect 10 ms 268 KB Not correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 4 ms 200 KB Correct
3 Correct 13 ms 264 KB Correct
4 Correct 52 ms 400 KB Correct
5 Correct 58 ms 284 KB Correct
6 Incorrect 10 ms 264 KB Not correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Correct
2 Correct 4 ms 200 KB Correct
3 Correct 13 ms 264 KB Correct
4 Correct 52 ms 400 KB Correct
5 Correct 58 ms 284 KB Correct
6 Incorrect 10 ms 264 KB Not correct
7 Halted 0 ms 0 KB -