Submission #971761

# Submission time Handle Problem Language Result Execution time Memory
971761 2024-04-29T09:02:50 Z idas The Collection Game (BOI21_swaps) C++17
50 / 100
369 ms 1904 KB
//
// --- Sample implementation for the task swaps ---
//
// To compile this program with the sample grader, place:
//     swaps.h swaps_sample.cpp sample_grader.cpp
// in a single folder and run:
//     g++ swaps_sample.cpp sample_grader.cpp
// in this folder.
//
#include <bits/stdc++.h>

using namespace std;

#include "swaps.h"
#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define sz(x) int((x).size())
#define pb push_back
#define s second
#define f first

typedef vector<int> vi;
typedef pair<int, int> pii;

void solve(int n, int v)
{
    vi a(n); FOR(i, 0, n) a[i]=i+1;

    FOR(i, 0, v)
    {
        if(i&1){
            for(int i=1; i+1<n; i+=2){
                schedule(a[i], a[i+1]);
            }
            vi get=visit();
            for(int i=1; i+1<n; i+=2){
                int in=(i-1)/2;
                if(get[in]==0){
                    swap(a[i], a[i+1]);
                }
            }
        }
        else{
            for(int i=0; i<n; i+=2){
                schedule(a[i], a[i+1]);
            }
            vi get=visit();
            for(int i=0; i<n; i+=2){
                int in=i/2;
                if(get[in]==0){
                    swap(a[i], a[i+1]);
                }
            }
        }
    }

    answer(a);
}
# Verdict Execution time Memory Grader output
1 Correct 28 ms 344 KB Correct
2 Correct 76 ms 344 KB Correct
3 Correct 180 ms 412 KB Correct
4 Correct 347 ms 1296 KB Correct
5 Correct 347 ms 1300 KB Correct
6 Correct 338 ms 1444 KB Correct
7 Correct 330 ms 1684 KB Correct
8 Correct 319 ms 1676 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 344 KB Correct
2 Correct 77 ms 344 KB Correct
3 Correct 172 ms 408 KB Correct
4 Correct 327 ms 1488 KB Correct
5 Correct 332 ms 1416 KB Correct
6 Correct 341 ms 1416 KB Correct
7 Correct 329 ms 1672 KB Correct
8 Correct 329 ms 1872 KB Correct
9 Correct 69 ms 1172 KB Correct
10 Correct 65 ms 1168 KB Correct
11 Correct 68 ms 1424 KB Correct
12 Correct 65 ms 1168 KB Correct
13 Correct 66 ms 920 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 344 KB Correct
2 Correct 77 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 344 KB Correct
2 Correct 77 ms 344 KB Correct
3 Correct 28 ms 344 KB Correct
4 Correct 83 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 344 KB Correct
2 Correct 76 ms 344 KB Correct
3 Correct 170 ms 408 KB Correct
4 Correct 330 ms 1436 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 344 KB Correct
2 Correct 76 ms 344 KB Correct
3 Correct 170 ms 408 KB Correct
4 Correct 330 ms 1436 KB Correct
5 Correct 30 ms 344 KB Correct
6 Correct 75 ms 344 KB Correct
7 Correct 229 ms 408 KB Correct
8 Correct 325 ms 1408 KB Correct
9 Correct 330 ms 1572 KB Correct
10 Correct 326 ms 1672 KB Correct
11 Correct 331 ms 1552 KB Correct
12 Correct 323 ms 1824 KB Correct
13 Correct 29 ms 344 KB Correct
14 Correct 88 ms 596 KB Correct
15 Correct 177 ms 416 KB Correct
16 Correct 352 ms 1508 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 344 KB Correct
2 Correct 79 ms 344 KB Correct
3 Correct 172 ms 416 KB Correct
4 Correct 369 ms 1684 KB Correct
5 Correct 37 ms 1436 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 344 KB Correct
2 Correct 79 ms 344 KB Correct
3 Correct 172 ms 416 KB Correct
4 Correct 369 ms 1684 KB Correct
5 Correct 37 ms 1436 KB Correct
6 Correct 27 ms 344 KB Correct
7 Correct 81 ms 344 KB Correct
8 Correct 185 ms 412 KB Correct
9 Correct 321 ms 1384 KB Correct
10 Correct 331 ms 1756 KB Correct
11 Correct 329 ms 1468 KB Correct
12 Correct 328 ms 1736 KB Correct
13 Correct 324 ms 1632 KB Correct
14 Correct 69 ms 1172 KB Correct
15 Correct 67 ms 1172 KB Correct
16 Correct 65 ms 1420 KB Correct
17 Correct 68 ms 916 KB Correct
18 Correct 69 ms 1420 KB Correct
19 Correct 30 ms 596 KB Correct
20 Correct 85 ms 344 KB Correct
21 Correct 181 ms 416 KB Correct
22 Correct 350 ms 1368 KB Correct
23 Correct 35 ms 688 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 344 KB Correct
2 Correct 76 ms 344 KB Correct
3 Correct 170 ms 408 KB Correct
4 Correct 322 ms 1904 KB Correct
5 Correct 33 ms 1200 KB Correct
6 Incorrect 7 ms 808 KB Not correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 344 KB Correct
2 Correct 76 ms 344 KB Correct
3 Correct 170 ms 408 KB Correct
4 Correct 322 ms 1904 KB Correct
5 Correct 33 ms 1200 KB Correct
6 Incorrect 7 ms 808 KB Not correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 344 KB Correct
2 Correct 82 ms 344 KB Correct
3 Correct 164 ms 408 KB Correct
4 Correct 338 ms 1752 KB Correct
5 Correct 35 ms 1424 KB Correct
6 Incorrect 7 ms 604 KB Not correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 344 KB Correct
2 Correct 82 ms 344 KB Correct
3 Correct 164 ms 408 KB Correct
4 Correct 338 ms 1752 KB Correct
5 Correct 35 ms 1424 KB Correct
6 Incorrect 7 ms 604 KB Not correct
7 Halted 0 ms 0 KB -