Submission #1078764

#TimeUsernameProblemLanguageResultExecution timeMemory
1078764The_SamuraiPrisoner Challenge (IOI22_prison)C++17
44 / 100
17 ms1624 KiB
#include "prison.h"
#include "bits/stdc++.h"
using namespace std;

std::vector<std::vector<int>> devise_strategy(int n) {
    int x = 34;
    vector ans(x + 1, vector(n + 1, 0));
    for (int i = 0; i <= x; i++) {
        if (i % 5 == 0) {
            ans[i][0] = 0;
            for (int j = 1; j <= n; j++) {
                ans[i][j] = i + 1;
                int k = 13 - (i / 5) * 2;
                if (j & (1 << k)) ans[i][j] += 2;
                if (j & (1 << (k - 1))) ans[i][j] += 1;
            }
            continue;
        }
        ans[i][0] = 1;
        int a = i % 5 - 1, k = 13 - (i / 5) * 2;
        for (int j = 1; j <= n; j++) {
            int b = 0;
            if (j & (1 << k)) b += 2;
            if (j & (1 << (k - 1))) b += 1;
            if (a == b) {
                ans[i][j] = i - i % 5 + 5;
                if (ans[i][j] > x) ans[i][j] = 0;
                continue;
            }
            ans[i][j] = (a > b ? -2 : -1);
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...