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>> s(25, vector<int>(N+1));
s[0][0] = 0;
for(int i=1; i<=24; i++) {
if(i%2)
s[i][0] = 0;
else
s[i][0] = 1;
}
for(int j=1; j<=N; j++) {
if((j & (1 << 12)))
s[0][j] = 24;
else
s[0][j] = 12;
}
for(int i=24; i>=13; i--) {
for(int j=1; j<=N; j++) {
if(!(j & (1 << (i-12)))) {
if(i%2)
s[i][j] = -1;
else
s[i][j] = -2;
}
else if(i == 13) {
if(j%2)
s[i][j] = -2;
else
s[i][j] = -1;
}
else if((j & (1 << (i-13))))
s[i][j] = i-1;
else
s[i][j] = i-13;
}
}
for(int i=12; i>0; i--) {
for(int j=1; j<=N; j++) {
if((j & (1 << i))) {
if(i%2)
s[i][j] = -2;
else
s[i][j] = -1;
}
else if(i == 1) {
if(j%2)
s[i][j] = -2;
else
s[i][j] = -1;
}
else if((j & (1 << (i-1))))
s[i][j] = i+11;
else
s[i][j] = i-1;
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |