# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
627143 | haojiandan | Prisoner Challenge (IOI22_prison) | C++17 | 13 ms | 1236 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;
int Get(int x) {
if (x==0) return -1; return -2;
}
vector<vector<int>> devise_strategy(int n) {
vector<vector<int> > res(27,vector<int>(n+1));
res[0][0]=0;
for (int i=1;i<=n;i++) res[0][i]=((i>>12&1)?2:1);
for (int i=1;i<=26;i++) {
int bit=12-(i+1)/2+1;
res[i][0]=(i%4==0||i%4==3?0:1);
int lst=(i%2==0?1:0);
int nxt=(i%2==0?i+1:i+2);
for (int j=1;j<=n;j++) {
int now=(j>>bit&1);
if (now!=lst) {
if (now<lst) res[i][j]=Get(res[i][0]);
else res[i][j]=Get(res[i][0]^1);
} else {
res[i][j]=((j>>(bit-1)&1)?nxt+1:nxt);
res[i][j]=min(res[i][j],26);
}
}
}
/*for (int i=0;i<=26;i++) {
for (int j=1;j<=n;j++) printf("%d ",res[i][j]); puts("");
}*/
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |