Submission #648360

# Submission time Handle Problem Language Result Execution time Memory
648360 2022-10-06T08:43:45 Z berr The Collection Game (BOI21_swaps) C++17
27 / 100
111 ms 12684 KB
#include <bits/stdc++.h>
#include "swaps.h"
using namespace std;


void solve(int N, int V)
{
    vector<array<int, 2>> a[V];
    vector<vector<int>> vis(V, vector<int>(N+1));

    vector<vector<int>> c(N+1, vector<int>(N+1));



    for(int i=1; i<=N; i++)
    {
        for(int l=i+1; l<=N; l++)
        {
            int flag=1;
            for(int j=0; j<V&&flag; j++)
            {
                if(vis[j][i]==0&&vis[j][l]==0)
                {
                    a[j].push_back({i, l});
                    vis[j][i]=1;
                    vis[j][l]=1;
                    flag=0;
                }
            }
        }
    }

    for(int i=0; i<V&&a[i].size(); i++)
    {
        for(auto l: a[i]) schedule(l[0], l[1]);
        auto b=visit();

        for(int l=0; l<a[i].size(); l++)
        {
            if(b[l]==1) c[a[i][l][0]][a[i][l][1]]=1, c[a[i][l][1]][a[i][l][0]]=0;
            else c[a[i][l][0]][a[i][l][1]]=0, c[a[i][l][1]][a[i][l][0]]=1;
        }
    }


    vector<array<int, 2>> q;
    vector<int> s;
    for(int i=1; i<=N; i++)
    {
        int l=0;
        for(auto j: c[i]) if(j==0) l++;
            q.push_back({l, i});
    }

    sort(q.begin(), q.end());

    for(auto i: q) s.push_back(i[1]);

    answer(s);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int l=0; l<a[i].size(); l++)
      |                      ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2688 KB Correct
3 Correct 29 ms 6016 KB Correct
4 Correct 86 ms 12476 KB Correct
5 Correct 102 ms 12548 KB Correct
6 Correct 105 ms 12476 KB Correct
7 Correct 86 ms 12472 KB Correct
8 Correct 101 ms 12576 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 6 ms 2680 KB Correct
3 Correct 20 ms 6096 KB Correct
4 Correct 99 ms 12472 KB Correct
5 Correct 96 ms 12668 KB Correct
6 Correct 87 ms 12592 KB Correct
7 Correct 97 ms 12472 KB Correct
8 Correct 86 ms 12684 KB Correct
9 Correct 86 ms 4492 KB Correct
10 Correct 108 ms 4472 KB Correct
11 Correct 88 ms 4416 KB Correct
12 Correct 92 ms 4400 KB Correct
13 Correct 88 ms 4504 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2640 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2640 KB Correct
3 Incorrect 1 ms 720 KB Not correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2684 KB Correct
3 Correct 21 ms 6076 KB Correct
4 Correct 111 ms 12540 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2684 KB Correct
3 Correct 21 ms 6076 KB Correct
4 Correct 111 ms 12540 KB Correct
5 Correct 1 ms 720 KB Correct
6 Correct 6 ms 2688 KB Correct
7 Correct 24 ms 6056 KB Correct
8 Correct 111 ms 12628 KB Correct
9 Correct 84 ms 12472 KB Correct
10 Correct 94 ms 12480 KB Correct
11 Correct 101 ms 12476 KB Correct
12 Correct 92 ms 12476 KB Correct
13 Incorrect 1 ms 720 KB Not correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 6 ms 2660 KB Correct
3 Correct 23 ms 5968 KB Correct
4 Correct 100 ms 12600 KB Correct
5 Incorrect 93 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 6 ms 2660 KB Correct
3 Correct 23 ms 5968 KB Correct
4 Correct 100 ms 12600 KB Correct
5 Incorrect 93 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 720 KB Correct
2 Correct 5 ms 2680 KB Correct
3 Correct 25 ms 5968 KB Correct
4 Correct 91 ms 12480 KB Correct
5 Incorrect 80 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 720 KB Correct
2 Correct 5 ms 2680 KB Correct
3 Correct 25 ms 5968 KB Correct
4 Correct 91 ms 12480 KB Correct
5 Incorrect 80 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2688 KB Correct
3 Correct 20 ms 6008 KB Correct
4 Correct 97 ms 12476 KB Correct
5 Incorrect 89 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2688 KB Correct
3 Correct 20 ms 6008 KB Correct
4 Correct 97 ms 12476 KB Correct
5 Incorrect 89 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -