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

Автор siddhant4583agarwal, история, 20 месяцев назад, По-английски

https://mirror.codeforces.com/contest/1796/problem/B

This question I tried using LCM. I would make dp table for LCM and for finding LCM, I will traverse the table and wherever the elements in string a and b are same I will add that to my answer string else I will add '*'. Then I will remove all the consecutive '*' and check if number of asterisk are less than or equal to letters then I will print "YES" else print "NO".

When I am running this code I am getting "wrong answer The jury has the answer but the participant doesn't (test case 1333)". Can anyone tell what is wrong in my code and when do we get this error?

My submission link is: https://mirror.codeforces.com/contest/1796/submission/195562144

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

»
20 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

It means that you printed NO but the actual answer is YES

»
20 месяцев назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

A counter example:

1
daebfcguvw
haibjckuvx

The answer can be

YES
*uv*

But your solution outputs NO.

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

In fact, you only need to consider of 3 cases: "*a", "a*" and "*ab*". All asterisk-minor templates can be represented by one of them.