Need Help for problem

can anybody give me a approach??I cant solve it…getting WA…please… help…
link text

The most common error people commit on that Q is-

For an array of size n, We have to consider it BEAUTIFUL by default.

Also, please tell something about your logic and what you intended to do. Cause you used “a[i]%a[j]==0” which i cant understand. The entire problem was based on few observations -

(Like if array has >1 elements such that abs(arr[i])>1, then its not beautiful. Then the Q narrows down to making cases when only 0,1 and -1 are in array.)

My solution for reference-

https://www.codechef.com/viewsolution/13779909

1 Like

and why is that??

Clarification given by contest admin-

An application of some definition should work in this way, take the definition, apply on your object (in this case array), if it violates the conditions, then the array is bad, otherwise it is good. Now, our example for n = 1, there are no two i, j such that i != j, so the array is good implicitly. This type of statements are called vacuously true.

Here- Problem with ICPC16B Beautiful Arrays - general - CodeChef Discuss