Submission #1061502

#TimeUsernameProblemLanguageResultExecution timeMemory
1061502MarwenElarbiPrisoner Challenge (IOI22_prison)C++17
0 / 100
2 ms604 KiB
#include <bits/stdc++.h>
#include "prison.h"
using namespace std;
#define pb push_back
#define ll long long
#define fi first
#define se second

std::vector<std::vector<int>> devise_strategy(int N) {
    vector<vector<int>> tab(29,vector<int> (N+1,0));
    int n=N;
    tab[0][0]=tab[27][0]=tab[28][0]=0;
    for (int i = 1; i < n+1; ++i)
    {
        tab[0][i]=20+i/100;
        if(tab[0][i]==20) tab[0][i]=26;
        tab[27][i]=(i%100)/10;
        if(tab[27][i]==0) tab[27][i]=10;
        tab[28][i]=10+(i%10);
        if(tab[28][i]==10) tab[28][i]=20;
    }
    for (int i = 21; i <= 26; ++i)
    {
        int cur=i%10;
        if(cur==6) cur=0;
        tab[i][0]=1;
        for (int j = 1; j < n+1; ++j)
        {
            if(j/100>cur) tab[i][j]=-1;
            else if(j/100<cur) tab[i][j]=-2;
            else tab[i][j]=27;
        }
    }
    for (int i = 1; i <= 10; ++i)
    {
        tab[i][0]=1;
        for (int j = 1; j < n+1; ++j)
        {
            if((j%100)/10>i%10) tab[i][j]=-1;
            else if((j%100)<i%10) tab[i][j]=-2;
            else tab[i][j]=28;
        }
    }
    for (int i = 11; i <= 20; ++i)
    {
        tab[i][0]=1;
        for (int j = 1; j < n+1; ++j)
        {
            if(j%10>i%10) tab[i][j]=-1;
            else if(j%10<i%10) tab[i][j]=-2;
            else tab[i][j]=28;
        }
    }
  return tab;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...