답안 #648692

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
648692 2022-10-07T13:33:34 Z berr The Collection Game (BOI21_swaps) C++17
27 / 100
129 ms 12604 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++)
      |                      ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2684 KB Correct
3 Correct 22 ms 5968 KB Correct
4 Correct 102 ms 12476 KB Correct
5 Correct 86 ms 12476 KB Correct
6 Correct 88 ms 12484 KB Correct
7 Correct 92 ms 12476 KB Correct
8 Correct 108 ms 12476 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 848 KB Correct
2 Correct 5 ms 2688 KB Correct
3 Correct 19 ms 6016 KB Correct
4 Correct 101 ms 12476 KB Correct
5 Correct 105 ms 12476 KB Correct
6 Correct 84 ms 12472 KB Correct
7 Correct 88 ms 12572 KB Correct
8 Correct 82 ms 12488 KB Correct
9 Correct 85 ms 4412 KB Correct
10 Correct 112 ms 4404 KB Correct
11 Correct 83 ms 4396 KB Correct
12 Correct 92 ms 4504 KB Correct
13 Correct 89 ms 4404 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 7 ms 2684 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 7 ms 2684 KB Correct
3 Incorrect 1 ms 848 KB Not correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Correct
2 Correct 5 ms 2684 KB Correct
3 Correct 26 ms 6100 KB Correct
4 Correct 101 ms 12496 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Correct
2 Correct 5 ms 2684 KB Correct
3 Correct 26 ms 6100 KB Correct
4 Correct 101 ms 12496 KB Correct
5 Correct 1 ms 720 KB Correct
6 Correct 4 ms 2688 KB Correct
7 Correct 23 ms 5968 KB Correct
8 Correct 91 ms 12604 KB Correct
9 Correct 98 ms 12476 KB Correct
10 Correct 97 ms 12476 KB Correct
11 Correct 90 ms 12476 KB Correct
12 Correct 108 ms 12476 KB Correct
13 Incorrect 1 ms 720 KB Not correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2640 KB Correct
3 Correct 22 ms 6052 KB Correct
4 Correct 98 ms 12476 KB Correct
5 Incorrect 94 ms 3372 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2640 KB Correct
3 Correct 22 ms 6052 KB Correct
4 Correct 98 ms 12476 KB Correct
5 Incorrect 94 ms 3372 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 6 ms 2584 KB Correct
3 Correct 21 ms 6016 KB Correct
4 Correct 101 ms 12552 KB Correct
5 Incorrect 129 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 6 ms 2584 KB Correct
3 Correct 21 ms 6016 KB Correct
4 Correct 101 ms 12552 KB Correct
5 Incorrect 129 ms 3376 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2688 KB Correct
3 Correct 29 ms 5968 KB Correct
4 Correct 104 ms 12512 KB Correct
5 Incorrect 103 ms 3488 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 720 KB Correct
2 Correct 5 ms 2688 KB Correct
3 Correct 29 ms 5968 KB Correct
4 Correct 104 ms 12512 KB Correct
5 Incorrect 103 ms 3488 KB Not correct
6 Halted 0 ms 0 KB -