Submission #1071649

# Submission time Handle Problem Language Result Execution time Memory
1071649 2024-08-23T09:38:21 Z Boas Radio Towers (IOI22_towers) C++17
Compilation error
0 ms 0 KB
#include "prison.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

template <typename T1, typename T2>
using indexed_map = tree<T1, T2, less<T1>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using indexed_set = indexed_map<T, null_type>;

#define loop(x, i) for (int i = 0; i < (x); i++)
#define loop1(x, i) for (int i = 1; i <= (x); i++)
#define rev(x, i) for (int i = (int)(x) - 1; i >= 0; i--)
#define itloop(x) for (auto it = begin(x); x != end(x); it++)
#define itrev(x) for (auto it = rbegin(x); x != rend(x); it++)
#define INF ((int64_t)(4e18 + 1))
#define INF32 ((int32_t)(2e9 + 1))
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define removeIn(x, l) l.erase(find(ALL(l), x))
#define pb push_back
#define sz(x) (int)(x).size()
#define F first
#define S second
#define var const auto &
#define foreach(l) for (var e : l)

typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;
typedef vector<viii> vviii;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;
typedef vector<si> vsi;
typedef vector<sii> vsii;
typedef vector<vsi> vvsi;
typedef vector<string> vstr;
typedef vector<vector<string>> vvstr;
typedef vector<bool> vb;
typedef vector<vb> vvb;

string toBase3(int num)
{
  string res;
  if (num == 0)
    return "00000000";
  while (num > 0)
  {
    res = (char)('0' + (num % 3)) + res;
    num /= 3;
  }
  while (sz(res) < 8)
    res.insert(res.begin(), '0');
  return res;
}

vvi devise_strategy(int N)
{
  vvi s(24, vi(N + 1));
  s[0][0] = 0;
  loop1(N, A)
  {
    string nm = toBase3(A);
    s[0][A] = ('3' - nm[0]);
  }
  loop(8, i)
  {
    s[3 * i + 1][0] = (i % 2 == 0);
    s[3 * i + 2][0] = (i % 2 == 0);
    if (i != 7)
      s[3 * i + 3][0] = (i % 2 == 0);
    int cur = -2;
    int other = -1;
    if (i % 2 == 1)
      swap(cur, other);
    loop(3, a)
    {
      if (i == 7 && a == 0)
        continue;
      int ix = 3 * i + (3 - a);
      loop1(N, B)
      {
        string nm = toBase3(B);
        if (nm[i] < ('0' + a))
          s[ix][B] = cur;
        else if (nm[i] > ('0' + a))
          s[ix][B] = other;
        else
        {
          if (i == 7)
          {
            s[ix][B] = -1; // impossible
          }
          else if (B == 1)
          {
            s[ix][B] = cur;
          }
          else if (i == 6 && nm[i + 1] == '0')
          {
            s[ix][B] = other;
          }
          else
            s[ix][B] = 3 * (i + 1) + ('3' - nm[i + 1]);
        }
      }
    }
  }
  return s;
}

Compilation message

towers.cpp:1:10: fatal error: prison.h: No such file or directory
    1 | #include "prison.h"
      |          ^~~~~~~~~~
compilation terminated.