Submission #1056959

#TimeUsernameProblemLanguageResultExecution timeMemory
1056959epicci23Prisoner Challenge (IOI22_prison)C++17
65 / 100
7 ms1116 KiB
#include "bits/stdc++.h"
#include "prison.h"
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;


int check(int a,int j){
  return a>>j&1;
}

vector<vector<int>> devise_strategy(int N) {
  vector<vector<int>> v(25,vector<int>(N+1,0));
  v[0][0]=0;
  for(int i=1;i<=N;i++) v[0][i]=1+check(i,12);
  for(int i=1;i<=24;i++){
  	if((i-1)%4<=1) v[i][0]=1;
  	else v[i][0]=0;
  } 
  for(int j=12;j>=1;j--){
    for(int i=1;i<=N;i++){
      int xd=check(i,j);
      int xd2=!check(i,j-1);
      if(xd){
        if(j>1) v[(13-j)*2][i]=(14-j)*2-xd2;
        else if(check(i,j-1))  v[(13-j)*2][i]=-2;
        else v[(13-j)*2][i]=-1;
        if(!(j&1)) v[(13-j)*2-1][i]=-1;
        else v[(13-j)*2-1][i]=-2;
      }
      else{
        if(!(j&1)) v[(13-j)*2][i]=-2;
        else v[(13-j)*2][i]=-1;
        if(j==1){ 
          if(check(i,j-1)) v[(13-j)*2-1][i]=-2;
          else v[(13-j)*2-1][i]=-1;
        }
        else v[(13-j)*2-1][i]=(14-j)*2-xd2;
      }
    }
  }


  return v;
}

/*void _(){
	
}

int32_t main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int tc=1;//cin >> tc;
  while(tc--) _();
  return 0;
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...