Submission #769601

#TimeUsernameProblemLanguageResultExecution timeMemory
769601adrilenPrisoner Challenge (IOI22_prison)C++17
0 / 100
8 ms596 KiB
#include "prison.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using arr = array<int, 2>;
using arrr = array<int, 3>;

// Bruker tretalls systemet

std::vector<std::vector<int>> devise_strategy(int n) {
    int x = 24, s = x + 1;
    vector<vector<int>> output(s, vector<int>(n + 1));

    // Open bag A
    output[0][0] = 0;

    for (int j = 1; j <= n; j++)
    {
        output[0][j] = 7 * 3 + 1 + (j / (int)pow(3, 7));
        // cout << output[0][j] << "\n";
    }

    
    for (int y = 1; y <= 7; y++ )
    {
        for (int i = 1 + y * 3; i <= (y + 1) * 3; i++)
        {
            output[i][0] = (y & 1);

            for (int j = 1; j <= n; j++)
            {
                if (y * 3 + 1 + ((j % (int)pow(3, y + 1)) / (int)pow(3, y)) == i)
                {
                    output[i][j] = (y - 1) * 3 + 1 + ((j % (int)pow(3, y)) / (int)pow(3, y - 1));
                } else if (i > y * 3 + 1 + ((j % (int)pow(3, y + 1)) / (int)pow(3, y)))
                {
                    output[i][j] = -1 - (y & 1);
                } else {
                    output[i][j] = -1 - ((y + 1) & 1);
                }
            }
        }
    }

    for (int i = 1; i <= 3; i++)
    {
        output[i][0] = 1;

        for (int j = 1; j <= n; j++)
        {
            if (j % 3 > i % 3)
            {
                output[i][j] = -1;
            } else if (j % 3 < i % 3)
            {
                output[i][j] = -2;
            } else {
                output[i][j] = 0;
            }
        }
    }




    return output;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...