Atcoder Beginner Contest-177 Problem E

Question Link :

Submission Link:


  1. Make a visited array and mark the factors as visited int that array While traversing the whole array
  2. If at some point i encounter a factor that is already visited I make my ok variable false saying that the set cannot be pairwise co prime
  3. And then i calculate the gcd of all the numbers and if that’s equal to 1 then i say that the array is setwise coprime
  4. if nothing of the above satisfies then i’'ll print not coprime

Why Am I Getting wa in some TESTS ?

if(n % k == 0)

It should be

if(a[i] % k == 0)

Such a noob i am :neutral_face: