Official algorithmic problem description and constraints.
Mocha likes arrays, so before her departure, 378QAQ gave her an array π consisting of π positive integers as a gift.
Mocha thinks that π is beautiful if there exist two numbers π and π (1β€π,πβ€π, πβ π) such that for all π (1β€πβ€π), ππ is divisible by either ππ or ππ.
Determine whether π is beautiful. π₯ is divisible by π¦ if there exists an integer π§ such that π₯=π¦β π§.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.