Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

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

PROBLEM -> https://codeforces.me/problemset/problem/1389/C

I have been trying to solve this problem and my logic to try achieve that was:

Compare the Left Cyclic Array with the Right Cyclic Array.If both are equal,the array is good.If it doesn't check if the numbers of the input array are different.If they are,subtract the length by 2,because a good array would be a combination of just 2 items of them,such:

95381 -> 51

If there is a number duplicated in the input array,such (1,1,2,3,4,5); Count the number of occurrences of the most frequent number.Use this to subtract from array length. Example:(1,1,1,1,2,3);(4 occurences of the number "1") A Good String would be: 1111 . Array length = 6 => 6(length)-4(occurrences)="2".

In the first test,it worked.But in the second not. You can see my last submission in PHP: https://codeforces.me/submissions/luizantonioprg Is my logic wrong?

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