Submission #858698

#TimeUsernameProblemLanguageResultExecution timeMemory
858698nninPrisoner Challenge (IOI22_prison)C++17
30 / 100
21 ms1884 KiB
#include "prison.h" #include <vector> #include<bits/stdc++.h> using namespace std; int power(int x) { int ret = 1; while(x--) ret *= 10; return ret; } std::vector<std::vector<int>> devise_strategy(int N) { vector<vector<int>> ret(50, vector<int>(N+1, 0)); ret[0][0] = 0; for(int k=1;k<=N;k++) { ret[0][k] = 10+(k/1000); } for(int i=1;i<=4;i++) { for(int j=0;j<10;j++) { ret[(i*10)+j][0] = i%2; for(int k=1;k<=N;k++) { int dig = (k/power(4-i))%10; if(dig>j) { if(i%2) ret[(i*10)+j][k] = -1; else ret[(i*10)+j][k] = -2; } else if(dig<j) { if(i%2) ret[(i*10)+j][k] = -2; else ret[(i*10)+j][k] = -1; } else { if(i<4) ret[(i*10)+j][k] = ((i+1)*10)+((k/power(3-i))%10); } } } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...