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;
vector <vector <int> > devise_strategy(int N){
vector <vector <int> > ans;
for (int i=0; i<=29; i++){
ans.push_back({});
for (int j=0; j<=N; j++) ans.back().push_back(0);
}
for (int i=0; i<=29; i++){
for (int j=0; j<=N; j++){
if (!j){
if (i==0||i==5||i==11||i==17||i==23||i==29) ans[i][j]=0;
else ans[i][j]=1;
} else if (!i){
ans[i][j]=(j-1)/1250+1;
} else if (i<=4){
int th=(j-1)/1250+1;
if (i<th) ans[i][j]=-1;
else if (i>th) ans[i][j]=-2;
else ans[i][j]=5;
} else if (i==5){
ans[i][j]=(j-1)/250%5+6;
} else if (i<=10){
int th=(j-1)/250%5+6;
if (i<th) ans[i][j]=-1;
else if (i>th) ans[i][j]=-2;
else ans[i][j]=11;
} else if (i==11){
ans[i][j]=(j-1)/50%5+12;
} else if (i<=16){
int th=(j-1)/50%5+12;
if (i<th) ans[i][j]=-1;
else if (i>th) ans[i][j]=-2;
else ans[i][j]=17;
} else if (i==17){
ans[i][j]=(j-1)/10%5+18;
} else if (i<=22){
int th=(j-1)/10%5+18;
if (i<th) ans[i][j]=-1;
else if (i>th) ans[i][j]=-2;
else ans[i][j]=23;
} else if (i==23){
ans[i][j]=(j-1)/2%5+24;
} else if (i<=28){
int th=(j-1)/2%5+24;
if (i<th) ans[i][j]=-1;
else if (i>th) ans[i][j]=-2;
else ans[i][j]=29;
} else if (i==29){
if (j%2==1) ans[i][j]=-1;
else ans[i][j]=-2;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |