Submission #444319

# Submission time Handle Problem Language Result Execution time Memory
444319 2021-07-13T15:23:26 Z blue The Collection Game (BOI21_swaps) C++17
Compilation error
0 ms 0 KB
#include "swaps.h"
#include <vector>
using namespace std;


void solve(int N, int V)
{
    vector<int> r(N);
    for(int i = 1; i <= N; i++) r[i - 1] = i;

    for(int v = 1; v <= min(V, N); v++)
    {
        if(v % 2 == 0)
        {
            for(int i = 0; i+1 < N; i += 2) schedule(r[i], r[i+1]);
            vector<int> C = visit();

            for(int i = 0; i+1 < N; i += 2)
                if(C[i/2] == 0)
                    swap(r[i+1], r[i]);
        }
        else
        {
            for(int i = 1; i+1 < N; i += 2) schedule(r[i], r[i+1]);
            vector<int> C = visit();

            for(int i = 0; i+1 < N; i += 2)
                if(C[i/2] == 0)
                    swap(r[i+1], r[i]);
        }
    }

    return r;
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:33:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   33 |     return r;
      |            ^