#include using namespace std; using ll = long long; using P = array; vector

p { {3, 2}, {2, 3}, {-2, 3}, {-3, 2}, {-3, -2}, {-2, -3}, {2, -3}, {3, -2}, {-3, 0}, {3, 0}, {0, 3}, {0, -3}, }; int main(int argc, char **argv) { ll N; cin >> N; auto solve = [](ll N) { vector memo; set

now, pre; pre.insert({0, 0}); memo.push_back(1); for (ll i = 0; i < N; ++i) { now = {}; for (auto [h, w] : pre) { for (auto [dh, dw] : p) { ll hh = h + dh; ll ww = w + dw; now.insert({hh, ww}); } } // デバッグ用 /* { std::cout << "########" << i+1 << "######"<< std::endl; // グリッド表示 std::cout << "grid : " << std::endl; const ll S = 80; vector> dis(S, vector(S, false)); for (auto [h, w] : now) { dis[h+S/2][w+S/2] = true; } for (ll h = 0; h < S; ++h) { for (ll w = 0; w < S; ++w) { char c = '.'; if (dis[h][w]) c = '#'; std::cout << c << " "; } std::cout << std::endl; } // マスの数 std::cout << "cnt : " << now.size() << std::endl; } */ swap(now, pre); } return pre.size(); }; std::cout << solve(N) << std::endl; }