TechNite's blog

By TechNite, 4 years ago, In English

I was getting WA on testcase 2 for the mastermind problem(DIV2E/DIV1C) in codeforces round 658. Here is my submission 87685109. The basic idea is that for perfect matching i choose thethe color with maximum frequency at each step. And after that i swap the two most frequent colors in n-x indices taking care of the odd case.(In odd case i do right cyclic shift for 3 most frequent colors)

Can anyone help me why i am getting wrong answer for this

Thanks

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it +15 Vote: I do not like it

The test is small, so you can fully retrieve it. Just change the program to not print anything but the test case 135 in the second test. I changed your code here (look at the start of solve function) and the test that breaks your code is

6 1 5
1 1 1 3 2 1
  • »
    »
    4 years ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    Ohh nice!! Thanks a lot for telling this. I never thought we can retreive a test case like this. :)

»
4 years ago, # |
  Vote: I like it +2 Vote: I do not like it

I did not know that there is a problem named after my handle :)