제출 #1082660

#제출 시각아이디문제언어결과실행 시간메모리
1082660aaaaaarroz죄수들의 도전 (IOI22_prison)C++17
0 / 100
0 ms352 KiB
#include <iostream> #include <vector> #include <cmath> using namespace std; vector<vector<int>> devise_strategy(int N) { // Determine the maximum number of bits required int bits_required = ceil(log2(N)); // Calculate the maximum value x int x = 3 * bits_required - 1; // Initialize the strategy list vector<vector<int>> strategy(x + 1, vector<int>(N + 1)); for (int i = 0; i <= x; ++i) { // Determine the bit position and state int bit_position = i / 3; int state = i % 3; if (state == 0) { // Check bit from bag A strategy[i][0] = 0; for (int j = 1; j <= N; ++j) { if ((j >> bit_position) & 1) { strategy[i][j] = 3 * (bit_position + 1); } else { strategy[i][j] = 3 * (bit_position + 1) + 1; } } } else if (state == 1) { // Check bit from bag B strategy[i][0] = 1; for (int j = 1; j <= N; ++j) { if ((j >> bit_position) & 1) { strategy[i][j] = 3 * (bit_position + 1); } else { strategy[i][j] = 3 * (bit_position + 1) + 1; } } } else if (state == 2) { // Compare and make a decision strategy[i][0] = 0; // Default bag A, adjust later for (int j = 1; j <= N; ++j) { if (j == N) { // Assume decision making based on observed values strategy[i][j] = -1; // Bag A has fewer coins } else { strategy[i][j] = -2; // Bag B has fewer coins } } } } return strategy; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...