Submission #740556

#TimeUsernameProblemLanguageResultExecution timeMemory
740556ALVINPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include <vector>

std::vector<std::vector<int>> devise_strategy(int N) {
    const int num_prisoners = 500;
    std::vector<std::vector<int>> strategy(num_prisoners+1, std::vector<int>(N+1, 0));
    
    for (int i = 1; i <= num_prisoners; ++i) {
        if (i <= 250) {
            strategy[i][0] = 0;  // Inspect bag A.
            for (int j = 1; j <= N; ++j) {
                if (i == j) {
                    strategy[i][j] = -1;  // Identify bag A as having fewer coins.
                } else {
                    strategy[i][j] = (i % num_prisoners) + 1;
                }
            }
        } else {
            strategy[i][0] = 1;  // Inspect bag B.
            for (int j = 1; j <= N; ++j) {
                if (i - 250 == j) {
                    strategy[i][j] = -2;  // Identify bag B as having fewer coins.
                } else {
                    strategy[i][j] = (i % num_prisoners) + 1;
                }
            }
        }
    }

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