# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
625840 | peti1234 | Prisoner Challenge (IOI22_prison) | C++17 | 5 ms | 596 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 <bits/stdc++.h>
using namespace std;
vector<vector<int> > devise_strategy(int n){
vector<vector<int>> ans(21);
for (int i=0; i<=20; i++) {
ans[i].resize(n+1);
}
int pos=0, ert=500;
for (int i=0; i<=17; i++) {
if (i%6==0) {
ert/=5;
ans[i][0]=0;
for (int j=1; j<=n; j++) {
int rem=(j-1)%(5*ert)/ert+1;
//cout << "fontos " << i <<" " << j << " " << ert << " " << rem << "\n";
ans[i][j]=i+rem;
}
} else {
ans[i][0]=1;
for (int j=1; j<=n; j++) {
int rem=(j-1)%(5*ert)/ert+1, aa=i%6;
if (rem<aa) ans[i][j]=-2;
if (aa<rem) ans[i][j]=-1;
if (aa==rem) ans[i][j]=i+6-rem;
}
}
}
ans[18][0]=0;
for (int j=1; j<=n; j++) {
int rem=(j-1)%4;
if (rem==0) ans[18][j]=-1;
if (rem==3) ans[18][j]=-2;
if (rem==1 || rem==2) ans[18][j]=18+rem;
}
for (int i=19; i<=20; i++) {
ans[i][0]=1;
for (int j=1; j<=n; j++) {
int rem=(j-1)%4, aa=i-18;
if (rem<aa) ans[i][j]=-2;
if (aa<rem) ans[i][j]=-1;
if (aa==rem) ans[i][j]=0;
}
}
return ans;
}
/*int main()
{
ios_base::sync_with_stdio(false);
vector<vector<int> > sz=devise_strategy(20);
for (auto x:sz) {
for (auto y:x) {
cout << y << " ";
}
cout << "\n";
}
return 0;
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |