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 <cassert>
#include <cstdio>
#include <bits/stdc++.h>
#include <string>
#include <vector>
using namespace std;
static constexpr int kNumPrisoners = 500;
vector<vector<int>> devise_strategy(int N){
int x = 38;
vector<vector<int>> strat(x + 1, vector<int>(N+1));
for(int i = 0; i <= x; i ++){
if(i < 13){
strat[i][0] = 0;
}
else{
strat[i][0] = 1;
}
if(i < 13){
int bit = (i == 0 ? 12 : (i - 1) % 12);
for(int j = 1; j <= N; j ++){
if(((1 << bit) & j)){
strat[i][j] = 26 + bit;
}
else{
strat[i][j] = 13 + bit;
}
}
}
else{
int sett = i >= 26;
int bit = i % 13;
for(int j = 1; j <= N; j ++){
if(((1 << bit) & j) && sett){
strat[i][j] = 1 + bit-1;
}
else if (!sett && ((1 << bit) & j)){
strat[i][j] = -1;
}
else if (sett && !((1 << bit) & j)){
strat[i][j] = -2;
}
else{
strat[i][j] = 1 + bit-1;
}
}
}
}
return strat;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |