Submission #730605

#TimeUsernameProblemLanguageResultExecution timeMemory
730605murad_2005Prisoner Challenge (IOI22_prison)C++17
5 / 100
27 ms19028 KiB
#include "prison.h"
#include <bits/stdc++.h>
#define ll long long

using namespace std;

std::vector<std::vector<int>> devise_strategy(int N) {
    int n = N;
    vector<vector<int>>s(n, vector<int>(n + 1, 0));
    for(int i = 0; i <= n; ++i){
        if(i == 0) s[0][i] = 0;
        else if(i == 1 || i == n){
            s[0][i] = (i == 1) ? -1 : -2;
        }else{
            s[0][i] = i - 1;
        }
    }
    for(int i = 1; i < n; ++i){ // values of x
        for(int j = 0; j <= n; ++j){
            if(j == 0) s[i][j] = 1;
            else if(j == 1 || j == n){
                s[i][j] = (j == 1) ? -2 : -1;
            }else{
                s[i][j] = (j <= i) ? -2 : -1;
            }
        }
    }
    return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...