Submission #1140280

#TimeUsernameProblemLanguageResultExecution timeMemory
1140280goatmarPrisoner Challenge (IOI22_prison)C++20
0 / 100
0 ms328 KiB
#include <vector>
using namespace std;

vector<vector<int>> devise_strategy(int N) {
    // Define the maximum x value (keeping it low for optimal scoring)
    const int x = 1; // Only two states: 0 and 1 for the whiteboard.
    
    // Create a strategy array s with x+1 rows and N+1 columns.
    vector<vector<int>> s(x + 1, vector<int>(N + 1));
    
    // Strategy for state 0
    s[0][0] = 0; // Prisoner inspects Bag A
    for (int j = 1; j <= N; ++j) {
        if (j % 2 == 1) {
            s[0][j] = -1; // Identify Bag A as having fewer coins
        } else {
            s[0][j] = 1;  // Write 1 on the whiteboard
        }
    }
    
    // Strategy for state 1
    s[1][0] = 1; // Prisoner inspects Bag B
    for (int j = 1; j <= N; ++j) {
        if (j % 2 == 1) {
            s[1][j] = -2; // Identify Bag B as having fewer coins
        } else {
            s[1][j] = 0;  // Write 0 on the whiteboard
        }
    }
    
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...