Submission #632803

#TimeUsernameProblemLanguageResultExecution timeMemory
632803MojoLakePrisoner Challenge (IOI22_prison)C++17
50 / 100
16 ms1364 KiB
#include <iostream> #include <vector> using namespace std; int max_dig = 13; int x = 30; int compare(int i, int j){ //store 2 * d or 2 * d + 1; int d = i / 2; int prev_pos = max_dig - d + 1; bool a = d % 2 == 0; bool prev_on = i % 2; bool cur_on = j & (1<<prev_pos); if(prev_on != cur_on){ return prev_on == a ? -1 : -2; } int cur_pos = max_dig - d; bool now_on = j & (1<<cur_pos); if(cur_pos == 0){ return now_on == a ? -2 : -1; } return 2 * (d + 1) + now_on; } //n = 243 //A = 18, B = 1 // vector<vector<int>> devise_strategy(int n){ vector<vector<int>> ret(x + 1, vector<int>(n+1)); for(int i = 0; i <= x; ++i){ for(int j = 0; j <= n; ++j){ if(j == 0){ ret[i][j] = (i/2)%2; continue; } if(i == 0){ bool on = j & (1<<max_dig); ret[i][j] = 2 + on; continue; } ret[i][j] = min(x, compare(i, j)); } } ret[0][0] = 0; return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...