priyanshu_x's blog

By priyanshu_x, history, 3 years ago, In English

In problem C, I wrote a solution that showed me the wrong answer on test case

For Those who don't know what is problem C
38 
6 9 6 6 6 2 8 6 6 8 5 4 6 6 9 0 0 4 4 3 6 0 0 5 4 5 0 8 4 6 4 8 0 7 5 0 0 8

My first code output 196, AC code output 210

My first code lexicographically largest array

9 8 7 6 9 8 6 8 6 5 4 3 2 0 8 6 5 4 0 8 6 5 4 0 6 5 4 0 6 4 0 6 4 0 6 0 6 0

AC code lexicographically largest array

9 8 7 6 5 4 3 2 0 9 8 6 5 4 0 8 6 5 4 0 8 6 5 4 0 8 6 4 0 6 6 6 4 0 6 0 6 0

I was amazed as I was sure with my logic, but after (successfully wasting more than 1.5 hours) I changed my approach and it got AC. After the contest was over I was thinking why my first solution was wrong and stress tested it. I got a test case

4
2 1 2 3

My first code is giving the lexicographically largest array as 3 2 2 1 whereas my AC code is giving 3 2 1 2, I am completely confused as the first output is better than the second one. Please help!

I am attaching my first code here.

Code

Sorry for my bad English.

  • Vote: I like it
  • +34
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The test cases were wrong. Setter solution was wrong.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I wasted around half of my time just debugging it :(

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      3,2,1,2 is correct as two groups formed are : [3,2,1],[2]. You had two conditions for groups: one was to form minimum number of groups and another condition was not to repeat the elements.
      How are you forming groups so that you are getting 3,2,2,1?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Yeah I was also getting same output (196) on the testcase you mentioned ...

Still wondering if my logic is wrong or the testcase is wrong.

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Yeah I was getting the same output of 196 on this testcase,was not left with much time to guess what the setter's brain was thinking.

»
3 years ago, # |
  Vote: I like it +11 Vote: I do not like it

This testcase wasted 2 hours of my time. And then after the contest ended I saw the mail (who checks mail during contests, the announcement could have easily come up in the contest page itself) that question B's testcases have been updated and will be rechecked. My last submission includes the hardcoded a=0, b=0 case which will be wrong after recheck. I am completely disappointed with this year's codagon. Last year it was lot of fun and problems were of good quality.

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

    I feel the last accepted solution will be considered. My solution for B had the same bug as the backend solution had, and it's a very small bug if I get anyhow WA verdict that time I would easily fix it. :(:(:( The same issue was for problem E. Completely amazed, such a prestigious contest having so many issues.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I also hardcoded that case but i didn't know that testcases were changed. There should be alert boxes for such notification i mean who tf uses emails in between of ongoing contests. Now that i know that testcases were changed and wasted my precious sunday for nothing, I am nothing but depressed, atleast i could've given codeforces round :(

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Even they mailed at 11:02 p.m. (i.e. after the contest ended)

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How Many you solved including B

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I faced literally the same problem