[CodeForces] The Meaningless Game

Problem

 

S: the set of numbers said by player 1;

P: the set of numbers said by player 2;

S^2 * P = a;

S * P^2 = b;

a * b = (S * P)^3, so a * b must be a perfect cubic number. Binary search to check this.

Let X be the cubic root of a * b, X = S * P. 

In order to have a valid S and P, then a must be divisible by X and b must be divisible by X.

 

posted @ 2022-01-18 06:35  Review->Improve  阅读(9)  评论(0编辑  收藏  举报