Блог пользователя kalzor

Автор kalzor, история, 4 года назад, По-английски

As the title says I need some help to find some test cases where my solution fails for the problem Cubes Sorting. My logic is simple, I first sort the array in decreasing order, then check if two elements are the same in the array. Then i check if the original array is in strictly decreasing order. If either the original array is not sorted in decreasing order or if there are two(or more) elements with the same value I print out YES else No. My Java Code:-

Spoiler

The logic seems right to me but it is still giving WA.Link to WA Submission 93757010. Any help is appreciated.

Update: Seems like the same code in C++ gives AC 93846515. Is there some error in my implementation of the solution?

  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

If you write your code in IntelliJ Idea, it shows a warning about objects comparisons. Don't ignore warnings. Idea is smarter than you. Make sure you have a green icon in the top-right corner of the editor before submit.