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 <iostream>
#include <vector>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
#define forsn(i, s, n) for(int i=s; i<(int)n; ++i)
const int Q=27;
vector<vector<int>> devise_strategy(int n) {
vector<vector<int>> ret(Q, vector<int>(n+1));
forn(i, Q) ret[i][0]=((i+1)>>1)&1;
forn(i, Q) forsn(j, 1, n+1){
int ex = (i+1)>>1;
int cas = (i&1);
if((!!(j&(1<<(13 - ex)))) ^ cas){
ret[i][j]=(cas^(ex&1))? -1 : -2;
}
else{
ret[i][j] = min(2*(ex+1) - !!(j&(1<<(13 - ex - 1))), Q-1);
}
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |