# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
828255 | ttamx | Catfish Farm (IOI22_fish) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
const int N=5005;
int n;
vector<vector<int>> devise_strategy(int _n){
n=_n;
int x=29;
vector<int> pw(8);
pw[0]=1;
for(int i=1;i<9;i++)pw[i]=pw[i-1]*3;
vector<vector<int>> s(x+1,vector<int>(n+1));
int id=0;
s[id][0]=0;
for(int j=1;j<=n;j++){
int val=j/pw[7]%3;
s[id][j]=id+val+1;
}
id++;
for(int i=7;i>=1;i--){
int c=i&1;
for(int x=0;x<3;x++){
s[id][0]=c;
for(int j=1;j<=n;j++){
int val=j/pw[i]%3;
if(val==x){