Submission #856488

#TimeUsernameProblemLanguageResultExecution timeMemory
856488samek08Prisoner Challenge (IOI22_prison)C++17
0 / 100
0 ms348 KiB
#include "prison.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a,b) for (int a = 0; a < (b); ++a)
#define pb push_back
#define all(t) t.begin(), t.end()

const int MAXM = 52;
vector<vector<int>> wyn;
vector<vector<int>> devise_strategy(int N)
{
  wyn.assign(MAXM+1,{});
  rep(i,MAXM+1) wyn[i].assign(N+1,-1);

  wyn[0][0] = 0;
  for(int i = 1; i <= N; ++i)
  {
    if(i % 2 == 0) wyn[0][i] = 1;
    else wyn[0][i] = 14;
  }
  for(int i = 1; i <= MAXM; ++i)
  {
    int idx = i;
    bool czy_pochodzi_z_A = true, czy_zapalony_bit = false;
    if(idx > 26)
    {
      czy_pochodzi_z_A = false, idx -= 26;
    }
    if(idx > 13)
    {
      czy_zapalony_bit = true, idx -= 13;
    }

    if(czy_pochodzi_z_A) wyn[i][0] = 1;
    else wyn[i][0] = 0;

    for(int j = 1; j <= N; ++j)
    {
      auto b = (1 << (idx-1)) & j;
      if(czy_zapalony_bit and !b)
      {
        if(czy_pochodzi_z_A) wyn[i][j] = -1;
        else wyn[i][j] = -2;
      }
      else if(!czy_zapalony_bit and b)
      {
        if(czy_pochodzi_z_A) wyn[i][j] = -2;
        else wyn[i][j] = -1;
      }
      else
      {
        int val = idx+1;
        if(czy_pochodzi_z_A) val += 26;
        auto bit_spr = (1 << idx) & j;
        if(bit_spr) val += 13;
        wyn[i][j] = val;
      }
    }
  }
  
  return wyn;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...