Submission #625516

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6255162022-08-10 14:17:30jeroenodbPrisoner Challenge (IOI22_prison)C++17
80 / 100
13 ms1076 KiB
#include "prison.h"
#include <array>
#include <vector>
using namespace std;
const int D = 10;
std::vector<std::vector<int>> devise_strategy(int N) {
array<int,D> dig = {2,2,2,3,3,3,3,3,3,1};
array<int,D> pw = {1};
for(int i=1;i<D;++i) pw[i]=pw[i-1]*dig[i-1];
auto extractDig = [&](int n, int i) {
n/=pw[i];
return n%dig[i];
};
auto endResult = [&](int dif, int f) {
if(f==0) dif=-dif;
if(dif<=0) return -2;
else return -1;
};
vector<vector<int>> res;
for(int i=D-1;i>=1;--i) {
// if(pw[i]>=N) continue;
int at = res.size();
// before
vector<int> cur(N+1);
for(int d=0;d<dig[i];++d) {
cur[0]=i&1;
for(int b=0;b<N;++b) {
if(extractDig(b,i)!=d) {
cur[b+1] = endResult(extractDig(b,i)-d, cur[0]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...