Game of Numbers
Mr. Yagami is playing a game of numbers. He has two arrays, each of size N denoted by A1,A2...AN and B1,B2...BN. Now, he has to make a move each minute. Let us maintain two sets S1 and S2 which are empty intially. In one move , first he'll pick a pair of indexes (i, j) such that it's already not present in S1. Also, Bj > Ai and GCD(Ai,Bj) is not 1. Further, he'll pick another pair of indices (p,
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.
Sign in to chat with the tutor and save your progress.
Sign in to start