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

Problem 1389C — Good String.Is my logic wrong ?

Правка en2, от luizantonioprg, 2020-08-26 23:45:49

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?

Теги php, good string

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский luizantonioprg 2020-08-26 23:45:49 6 Tiny change: 'irst test,this worked.Bu' -> 'irst test,it worked.Bu'
en1 Английский luizantonioprg 2020-08-26 23:43:20 959 Initial revision (published)