## Submission #1084134

# Submission time Handle Problem Language Result Execution time Memory
1084134 2024-09-05T10:03:40 Z SamueleVid Prisoner Challenge (IOI22_prison) C++17
0 / 100
1 ms 348 KB
```#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> devise_strategy(int N) {
int digits = log2(N);
// 3 * xxxxxx + y
// x = quale cifra sto guardando, sapendo che quelle più alte sono uguali
// y =  0 : sono in B e il bit di A è 0
//      1 : sono in B e il bit di A è 1
//      2 : sono in A e devo passare il bit di A in B

vector<vector<int>> s(3 * (digits + 1), vector<int>(N + 1));

for (int x = 0; x < 3 * (digits + 1); x ++) {
// cout << x << '\n';
int bit = x % 3;
int digit = x / 3;
// cout << "x : " << x << '\n';
// cout << "who, bit, digit " << who << " " << bit << " " << digit << '\n';
if (digit == 0) {
// start, occupa quattro casi ma è solo uno tho
s[x][0] = 0;
int digit_next = digits;
for (int j = 1; j <= N; j ++) {
int bit_next = (bool)(j & (1 << (digit_next - 1)));
s[x][j] = (digit_next * 3) + bit_next;
}
continue;
}
if (bit < 2) {
s[x][0] = 1;
int digit_next = digit;
for (int j = 1; j <= N; j ++) {
int bit_next = (bool)(j & (1 << (digit_next - 1)));
// cout << "bit_next : " << bit_next << '\n';
if (bit_next < bit) s[x][j] = -2;
if (bit < bit_next) s[x][j] = -1;
if (bit == bit_next) s[x][j] = (digit_next * 3) + 2;
}
}
if (bit == 2) {
s[x][0] = 0;
int digit_next = digit - 1;
for (int j = 1; j <= N; j ++) {
int bit_next = (bool)(j & (1 << (digit_next - 1)));
s[x][j] = (digit_next * 3) + bit_next;
}
}
}

return s;
}
```

#### Subtask #1 0.0 / 5.0

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Strategy failed for N=2, A=1, B=2
2 Halted 0 ms 0 KB -

#### Subtask #2 0.0 / 5.0

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Strategy failed for N=2, A=1, B=2
2 Halted 0 ms 0 KB -

#### Subtask #3 0 / 90.0

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Strategy failed for N=3, A=1, B=2
2 Halted 0 ms 0 KB -