# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
876466 | Andrey | Prisoner Challenge (IOI22_prison) | C++17 | 10 ms | 1116 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 "prison.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<std::vector<int>> devise_strategy(int n) {
vector<vector<int>> ans(0);
for(int i = 0; i < 27; i++) {
ans.push_back(vector<int> (n+1));
}
for(int i = 0; i < 27; i++) {
if(i == 0) {
ans[i][0] = 0;
for(int j = 1; j <= n; j++) {
ans[i][j] = 24;
if(j&(1 << 12)) {
ans[i][j]++;
}
}
}
else if(i == 1) {
ans[i][0] = 0;
for(int j = 1; j <= n; j++) {
if(j%2) {
ans[i][j] = -2;
}
else {
ans[i][j] = -1;
}
}
}
else {
int d = i/2;
int c = d%2;
bool x = i%2;
if(c == 0) {
ans[i][0] = 1;
}
else {
ans[i][0] = 0;
}
for(int j = 1; j <= n; j++) {
bool y = ((1 << d)&j);
if(x < y) {
if(c == 0) {
ans[i][j] = -1;
}
else {
ans[i][j] = -2;
}
}
else if(x > y) {
if(c == 0) {
ans[i][j] = -2;
}
else {
ans[i][j] = -1;
}
}
else {
if(d > 0) {
if(d == 1) {
ans[i][j] = 1;
}
else {
ans[i][j] = d*2-2+((j&(1 << (d-1))) > 0);
}
}
else {
ans[i][j] = 4;
}
}
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |