Submission #1320011

#TimeUsernameProblemLanguageResultExecution timeMemory
1320011BigBadBullyPrisoner Challenge (IOI22_prison)C++20
0 / 100
0 ms332 KiB

#include <bits/stdc++.h>
#include "prison.h"
using namespace std;




std::vector<std::vector<int>> devise_strategy(int n) {
    //za neko x
    //podijeli x sa 2 i gledaj mu prije ostatak sa 2
    //ostatak je koji je bit bio na k-toj poziciji
    int mx = 25;
    vector<vector<int>> ans(mx+1,vector<int>(n+1,-1));
    ans[0][0] = 1;
    for(int i = 1; i <= n; i++)
        ans[0][i] = mx-(((1<<12)&i)==0);
    for(int x = mx; x > 0; x--)
    {
        int bt = x/2, val = x%2;
        ans[x][0] = bt%2;
        if(val)
            for(int i = 1; i <= n; i++)
                ans[x][i] = ((i&(1<<bt))?2*bt-2+(((1<<bt-1)&i)>0):-1-(1-bt%2));
        else
            for(int i = 1; i <= n; i++)
                ans[x][i] = ((i&(1<<bt))?-1-bt%2:2*bt-2+(((1<<bt-1)&i)>0));
        if(bt==1)
        {
            for(int i = 1; i <= n; i++)
                if(ans[x][i] == 0)
                    ans[x][i] = (i%2?-2:-1);
        }
        if(x==1)
            for(int i = 1; i <= n; i++)
                ans[x][i] = (i%2?-1:-2);
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...