#include #include #include #include using namespace std; vector> get_observable_positions(int x, int y) { vector> positions; positions.emplace_back(x + 2, y - 1); positions.emplace_back(x + 2, y + 1); positions.emplace_back(x - 2, y - 1); positions.emplace_back(x - 2, y + 1); positions.emplace_back(x - 1, y - 2); positions.emplace_back(x + 1, y - 2); positions.emplace_back(x - 1, y + 2); positions.emplace_back(x + 1, y + 2); return positions; } int main() { int N; cin >> N; vector> umas(N); set> uma_positions; for (int i = 0; i < N; ++i) { cin >> umas[i].first >> umas[i].second; uma_positions.insert(umas[i]); } set> all_positions; for (const auto& uma : umas) { auto positions = get_observable_positions(uma.first, uma.second); for (const auto& pos : positions) { if (uma_positions.find(pos) == uma_positions.end()) { all_positions.insert(pos); } } } vector> kma_candidates(all_positions.begin(), all_positions.end()); int min_kma_count = N; // 最小値は最大でもN int candidate_size = kma_candidates.size(); for (int bit = 1; bit < (1 << candidate_size); ++bit) { set> observed_positions; for (int i = 0; i < candidate_size; ++i) { if (bit & (1 << i)) { auto observable = get_observable_positions(kma_candidates[i].first, kma_candidates[i].second); observed_positions.insert(observable.begin(), observable.end()); } } bool all_observed = true; for (const auto& uma : umas) { if (observed_positions.find(uma) == observed_positions.end()) { all_observed = false; break; } } if (all_observed) { min_kma_count = min(min_kma_count, __builtin_popcount(bit)); } } cout << min_kma_count << endl; return 0; }