#include "prison.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define mp make_pair
#define pb push_back
using namespace std;
ll set_on(int n, int k){
return (n |= 1 << k);
}
ll set_off(int n, int k){
return (n &= ~(1UL << k));
}
bool check_bit(int n, int k){
int bit = (n >> k) & 1U;
if(bit == 1)
return true;
return false;
}
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 <= N; i++){
for(int bit = 12; bit >= 0; bit--){
if(check_bit(i, bit)){
s[0][i] = bit; // od levo kon desno
break;
}
else
continue;
}
}
for(int i = 1; i <= 12; i++){
s[i][0] = 1;
for(int j = 1; j <= N; j++){
bool found = false;
for(int bit = 12; bit > i; bit--){
if(check_bit(j, bit)){
found = true;
break;
}
}
if(found){
s[i][j] = -1;
}
else{
if(!check_bit(j, i))
s[i][j]=-2;
else{
for(int bit = i-1; bit >= 0; bit--){
if(check_bit(j, bit)){
s[i][j] = bit+13;
found=true;
break;
}
}
}
}
}
}
for(int i = 13; i <= 24; i++){
s[i][0] = 0;
int x = i - 13;
for(int j = 1; j <= N; j++){
bool found = false;
for(int bit = 12; bit > x; bit--){
if(check_bit(j, bit)){
found = true;
break;
}
else
continue;
}
if(found)
s[i][j]=-2;
else{
if(!check_bit(j, x)){
s[i][j]=-1;
}
else{
for(int bit = x - 1; bit >= 0; bit--){
if(check_bit(j, bit)){
s[i][j] = bit;
found = true;
break;
}
}
}
}
}
}
return s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Strategy failed for N=2, A=1, B=2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Strategy failed for N=2, A=1, B=2 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Strategy failed for N=3, A=1, B=2 |
2 |
Halted |
0 ms |
0 KB |
- |