Submission #648403

# Submission time Handle Problem Language Result Execution time Memory
648403 2022-10-06T10:43:16 Z berr The Collection Game (BOI21_swaps) C++17
0 / 100
1 ms 208 KB
#include <bits/stdc++.h>
 
 
#include "swaps.h"
 
using namespace std;
 
void solve(int N, int V)
{
 
 
 
    vector<vector<int>> ans(1);
 
    for(int i=1; i<=N; i++)
    {
        ans[0].push_back(i);
    }
    int le=0, ri=N-1;
 
    vector<int> q(N);
    while(ans.size())
    {
 
        for(int i=0; i<ans.size(); i++)
        {
            for(int l=0; l<ans[i].size()-1; l+=2)
            {
                schedule(ans[i][l], ans[i][l+1]);
            }
        }
 
        vector<vector<int>> br(ans.size()+1);
 
        auto b=visit();
 
        int f=0;
        for(int i=0; i<ans.size(); i++)
        {
            for(int l=0; l<ans[i].size()-1; l+=2)
            {
               if(b[f]==1) br[i].push_back(ans[i][l]), br[i+1].push_back(ans[i][l+1]);
               else br[i].push_back(ans[i][l+1]), br[i+1].push_back(ans[i][l]);
               f++;
            }
            if(ans[i].size()%2) br[i].push_back(ans[i][ans[i].size()-1]);
        }
 
        ans.clear();
        int l=0, r=br.size();
        if(br[0].size()==1) l++, q[le]=br[0][0], le++;
        if(br[br.size()-1].size()==1&&br.size()>1) r--, q[ri]=br[br.size()-1][0], ri--;
 
        for(int i=l; i<r; i++)
        {
            ans.push_back(br[i]);
        }
 
 
    }
    answer(q);
 
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:25:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for(int i=0; i<ans.size(); i++)
      |                      ~^~~~~~~~~~~
swaps.cpp:27:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             for(int l=0; l<ans[i].size()-1; l+=2)
      |                          ~^~~~~~~~~~~~~~~~
swaps.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int i=0; i<ans.size(); i++)
      |                      ~^~~~~~~~~~~
swaps.cpp:40:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             for(int l=0; l<ans[i].size()-1; l+=2)
      |                          ~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -