The problem is 1349A - Orac and LCM My idea is: for a prime p, if the highest power divisible by p are stored in vector for all n numbers, LCM contribution due to this is max(2 numbers we are considering),so if we have <=n-2 numbers, we will get a 0( as max(0,0)=0) and hence gcd contribution because of this p is 1
Can anyone say reason why this is failing 301339390
Well your logic is correct. The problem with your code is that when counts.size() is exactly n-1 then
min1 = 0
automatically. Think about it. You already get a min of all as 0 as it's not present for all n. Just added that and got ACThankss