S10E - Editorial

https://www.codechef.com/viewsolution/27402788
shows WA
custom input shows correct answer
help plz

I’ve just done a seat-of-the-pants implementation of this plus a testcase generator, and it looks like your solution fails on the following testcase:

1
9
690 570 470 385 712 710 391 584 579 

Edit:

Diagnostics:

Day: 1 out of 9 Good
Day: 2 out of 9 Good
Day: 3 out of 9 Good
Day: 4 out of 9 Good
Day: 5 out of 9 Not good - price is 385 on day 4 which is <= 712
Day: 6 out of 9 Not good - price is 385 on day 4 which is <= 710
Day: 7 out of 9 Not good - price is 385 on day 4 which is <= 391
Day: 8 out of 9 Not good - price is 391 on day 7 which is <= 584
Day: 9 out of 9 Not good - price is 391 on day 7 which is <= 579
4
3 Likes

thank u so much!:slightly_smiling_face:
i’ll check it again

1 Like

Yours seems to fail on:

1
8
399 411 491 621 745 602 482 537 

This is what I get (I’ve added some diagnostics to my code to explain what’s going on):

Day: 1 out of 8 Good
Day: 2 out of 8 Not good - price is 399 on day 1 which is <= 411
Day: 3 out of 8 Not good - price is 411 on day 2 which is <= 491
Day: 4 out of 8 Not good - price is 491 on day 3 which is <= 621
Day: 5 out of 8 Not good - price is 621 on day 4 which is <= 745
Day: 6 out of 8 Not good - price is 491 on day 3 which is <= 602
Day: 7 out of 8 Not good - price is 411 on day 2 which is <= 482
Day: 8 out of 8 Not good - price is 482 on day 7 which is <= 537
1
3 Likes

https://www.codechef.com/viewsolution/27403656
thank u! managed to give a correct solution
used your testcase to find an error in my code

1 Like

Take a look at the breakdown of my BACREP submission, here:

https://www.codechef.com/viewsolution/27345547

There are 16 “Tasks”. Each “Task” is a test input file which is provided to your program as input when your submission is evaluated. These Tasks are grouped into subtasks[1] - for example, the Tasks/ test input files 0, 1, 2 3 and 12 are all grouped into Subtask #1.

Let’s see what the constraints section says about Subtask #1:

Subtask #1 (20 points): 1 \le N,Q \le 5000

That means that the test input in each of the Tasks 0, 1, 2, 3 and 12 are guaranteed to have N \le 5000 and Q \le 5000 - this means that a naive O(N \times Q) solution will likely satisfy this Subtask (i.e. will successfully pass Tasks 0, 1, 2 ,3 and 12), and so get at least 20 of the possible 100 points.

[1] Yes, you read that right: a subtask is, rather confusingly, formed out of tasks.

3 Likes

Can’t understand why my program is giving me the wrong answer, I have tested the program with some of the custom inputs mentioned in the comments but its still not working CodeChef: Practical coding for everyone. If somebody can please hep me understand where I am getting it wrong

Consider the testcase:

1
9
468 463 701 508 670 638 463 394 402

My results (with Diagnostic info):

Day: 1 out of 9 Good
Day: 2 out of 9 Good
Day: 3 out of 9 Not good - price is 463 on day 2 which is <= 701
Day: 4 out of 9 Not good - price is 463 on day 2 which is <= 508
Day: 5 out of 9 Not good - price is 508 on day 4 which is <= 670
Day: 6 out of 9 Not good - price is 508 on day 4 which is <= 638
Day: 7 out of 9 Not good - price is 463 on day 2 which is <= 463
Day: 8 out of 9 Good
Day: 9 out of 9 Not good - price is 394 on day 8 which is <= 402
3
1 Like

I Hope this Will Help You Alot
Just Go through it

And Subscribe My Channel Hello World Please.

What it is not accepting this although the answer is coming correct!

1 Like

Yours seems to fail on the following testcase:

1
8
675 499 431 629 611 412 420 389

My solution (with extra diagnostic output added) gives:

Day: 1 out of 8 Good
Day: 2 out of 8 Good
Day: 3 out of 8 Good
Day: 4 out of 8 Not good - price is 431 on day 3 which is <= 629
Day: 5 out of 8 Not good - price is 431 on day 3 which is <= 611
Day: 6 out of 8 Good
Day: 7 out of 8 Not good - price is 412 on day 6 which is <= 420
Day: 8 out of 8 Good
5

2 Likes

Thanks buddy!

1 Like

@ssjgz Need help :sweat_smile:
This is showing Wrong Answer

what is your thought process behind this solution? i can’t understand ,please explain!

Your logic seems OK (well - it seems to give the correct answers, at least XD), but read the “Output” section of the question carefully :slight_smile:

Why this is partially correct???

A bug in Codechef.

Can anyone look into THIS and let me know why the test has failed.

can you please tell me what’s wrong on this ?
https://www.codechef.com/viewsolution/27588673

1 Like

Tiny mistake :slight_smile: Consider the testcase:

2
7
375 750 723 662 647 656 619
7
375 750 723 662 647 656 619