In the recently concluded codeforces round 714 I tried problem D. My idea was start from the lowest elements move left and right . Mark the number which are part of a certain min number in vis array and then mark their gcd/min number. And then in the end traverse the visited array and add up the values. But I am getting WA in test 3. Please help ?