Submission #854546

#TimeUsernameProblemLanguageResultExecution timeMemory
854546ahsoltanPrisoner Challenge (IOI22_prison)C++17
36.50 / 100
15 ms1768 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 2137
#endif

const int LOG = 12;

vector<vector<int>> devise_strategy(int n) {
  vector<vector<int>> a(40, vector<int>(n + 1));
  for (int i = 0; i <= LOG; i++) {
    a[i][0] = 0;
    for (int j = 1; j <= n; j++) {
      int b = (j >> (LOG - i)) & 1;
      a[i][j] = 13 + 2 * i + b;
    }
  }
  for (int i = 0; i <= LOG; i++) {
    for (int p = 0; p < 2; p++) {
      a[13 + 2 * i + p][0] = 1;
      for (int j = 1; j <= n; j++) {
        int q = (j >> (LOG - i)) & 1;
        a[13 + 2 * i + p][j] = p == 1 && q == 0 ? -2 : (p == 0 && q == 1 ? -1 : i + 1);
      }
    }
  }
  return a;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...