답안 #648353

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
648353 2022-10-06T08:33:21 Z berr The Collection Game (BOI21_swaps) C++17
12 / 100
135 ms 11580 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<int> ans(N+1), pos(N+1);

    for(int i=1; i<=N; i++) ans[i]=i, pos[i]=i;


    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; 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]==0&&pos[a[i][l][0]]>pos[a[i][l][1]]) swap(ans[pos[a[i][l][0]]], ans[pos[a[i][l][1]]]), swap(pos[a[i][l][0]], pos[a[i][l][1]]);
            if(b[l]==1&&pos[a[i][l][0]]<pos[a[i][l][1]])swap(ans[pos[a[i][l][0]]], ans[pos[a[i][l][1]]]), swap(pos[a[i][l][0]], pos[a[i][l][1]]);
        }
    }

    vector<int> s;


    for(int i=N; i>=1; i--) s.push_back(ans[i]);

    answer(s);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:39: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]
   39 |         for(int l=0; l<a[i].size(); l++)
      |                      ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 720 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 40 ms 720 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 848 KB Correct
2 Correct 38 ms 2640 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 848 KB Correct
2 Correct 38 ms 2640 KB Correct
3 Incorrect 38 ms 848 KB Not correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 720 KB Correct
2 Correct 27 ms 2640 KB Correct
3 Correct 38 ms 5812 KB Correct
4 Correct 135 ms 11580 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 720 KB Correct
2 Correct 27 ms 2640 KB Correct
3 Correct 38 ms 5812 KB Correct
4 Correct 135 ms 11580 KB Correct
5 Incorrect 33 ms 848 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 720 KB Correct
2 Correct 47 ms 2512 KB Correct
3 Correct 64 ms 5808 KB Correct
4 Correct 125 ms 11472 KB Correct
5 Incorrect 104 ms 2372 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 720 KB Correct
2 Correct 47 ms 2512 KB Correct
3 Correct 64 ms 5808 KB Correct
4 Correct 125 ms 11472 KB Correct
5 Incorrect 104 ms 2372 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 720 KB Correct
2 Correct 66 ms 2592 KB Correct
3 Correct 36 ms 5824 KB Correct
4 Correct 120 ms 11472 KB Correct
5 Incorrect 111 ms 2368 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 720 KB Correct
2 Correct 66 ms 2592 KB Correct
3 Correct 36 ms 5824 KB Correct
4 Correct 120 ms 11472 KB Correct
5 Incorrect 111 ms 2368 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 720 KB Correct
2 Correct 43 ms 2640 KB Correct
3 Correct 72 ms 5812 KB Correct
4 Correct 127 ms 11492 KB Correct
5 Incorrect 89 ms 2432 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 45 ms 720 KB Correct
2 Correct 43 ms 2640 KB Correct
3 Correct 72 ms 5812 KB Correct
4 Correct 127 ms 11492 KB Correct
5 Incorrect 89 ms 2432 KB Not correct
6 Halted 0 ms 0 KB -