← All problemsSign in

City of Primes

Alan lives in the beautiful city of primes with $N$ houses where each house is numbered with some positive integer $h_i$ and no two houses in the city have a road connecting them, So Alan decided that he will lay a road between two houses A and B if the numbers written on those have same set of prime factors and if neither of the two houses already has a road connecting to some other house. Ala

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start