Submission #636509

#TimeUsernameProblemLanguageResultExecution timeMemory
636509FidanPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; typedef int ll; vector<vector<ll>> devise_strategy(ll n){ vector<vector<ll>> v(25, vector<ll> (n+1)); v[0][0]=0; ll i, j, k, bit, a, bj1, bj; for(i=1; i<=n; i++){ if(i>=4096) v[0][i]=24; else v[0][i]=23; } v[0][n]=-2; for(i=1; i<25; i++){ if(i%4==0 || i%4==3) v[i][0]=1; else v[i][0]=0; } for(j=1; j<=n; j++){ a=j/2%2; if(a==1){ v[1][j]=-2; if(j%2==0) v[2][j]=-1; else v[2][j]=-2; } else{ v[2][j]=-1; if(j%2==0) v[1][j]=-1; else v[1][j]=-2; } } for(i=3; i<25; i++){ for(j=1; j<=n; j++){ k=(i+1)/2; bit=(i+1)%2; if((j & (1<<k))>0) bj=1; else bj=0; if(bj==bit){ if((j & (1<<(k-1)))>0) bj1=1; else bj1=0; v[i][j]=2*k-1+bj1; } else if(bj==1){ if(v[0][j]==0) v[i][j]=-2; else v[i][j]=-1; } else{ if(v[0][j]==0) v[i][j]=-1; else v[i][j]=-2; } } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...