# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1023115 | vjudge1 | 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 <bits/stdc++.h>
using namespace std;
std::vector<std::vector<int>> devise_strategy(int N){
vector<vector<int>> s(27, vector<int>(N + 1, 0));
for(int x = 0; x < s.size(); x++){
if(!x){
s[x][0] = 0;
for(int i = 1; i <= N; i++){
s[x][i] = 25;
if(i & (1<<12)) s[x][i]++;
}
} else{
int k = (x - 1) / 2;
s[x][0] = 1 - (k & 1);
for(int i = 1; i <= N; i++){
bool c = 0;
if(i & (1<<k)) c = 1;
if(((x - 1) & 1) < c){
s[x][i] = - (s[x][0] ^ 1) - 1;
}
else if(((x - 1) & 1) > c){
s[x][i] = - s[x][0] - 1;
}
else{
s[x][i] = (k - 1) * 2 + 1;
if(i & (1<<(k-1))) s[x][i]++;
// cout << x << ' ' << k << ' ' << i << ' ' << bool(i & (1<<(k-1))) << s[x][i] << endl;
}
}
}
// cout << x << ' ' << s[x][0] << endl;
}
return s;
}
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... |