WA in INCRDEC

My code for Lunchtime problem INCRDEC
https://www.codechef.com/viewsolution/34838601
My approach

  1. Firstly, I checked that elements of given array are unique or not if unique I print YES and print array in sorted order.
  2. If its not unique, I create a Map and update it on encounter frequency more then one and append that element in a new list.
  3. I sorted the hashmap and check about the max key, if value of max(key) is greater then 1 print NO.
  4. Same I checked the values of rest keys if values are greater then 2 I took a variable, initialize it by 0 and update it to 1.
  5. Finally I check if variable if 0 print YES and reversely sort the list which I create in map and mearge it with set.
    please help me in finding my fault, please provide any testcase where my code going wrong.
    Thanks