You are not logged in. Please login at www.codechef.com to post your questions!

×

Unable to complete the subtasks.

I'm a total beginner to competitive programming and the sub-tasks are way over my head. So it would be appreciated if any body could take some time out and help me in understanding the sub tasks in the most easiest way possible.

Example : https://www.codechef.com/problems/CATSDOGS

Subtasks -

  1. Subtask #1 (20 points)

1 ≤ T ≤ 10^4

0 ≤ C, D ≤ 10^2 2. Subtask #2 (30 points)

1 ≤ T ≤ 10^5

0 ≤ C, D ≤ 10^3 3. Subtask #3 (50 points)

Original constraints

asked 29 Sep '17, 20:29

hari16999's gravatar image

1★hari16999
1
accept rate: 0%


You are missing out certain cases.
Give a try finding possible cases/conditions when count is correct or incorrect
In case you still get WA, here's the link of my solution.

link

answered 29 Sep '17, 21:00

shawnfrost's gravatar image

5★shawnfrost
966
accept rate: 14%

@hari16999
Some cases where your code outputs WA.

2
0 1 4
1 0 4

Output:
no
no

(29 Sep '17, 21:13) shawnfrost5★

As you want an explanation about sub-tasks , I am not going into the logic or solution to the problem itself , and writing only about how the sub-tasks and points system works.

In general , sub-tasks are nothing but sets of constraints on the minimum/maximum values of the variables defined in the problem.

In simple language , for the given problem , you will get 20 points if your program can show correct answers within the time limit when the value of T is between 1 and $10^4$ , and C and D are between 0 and 100 . You will get 20+30 points if your program can handle both this and larger values of T , C and D as mentioned in subtask 2, and will get 20+30+50=100 points if it can show correct results for all the three sets of constraints

How can a code pass one set of sub-tasks and fail others ?

As the constraints increase , your code might show wrong answer due to some faulty logic , or some variable overflow. The algorithm might not be optimized enough so it might exceed the time limit for larger constraints. Basically what it means is that only a correct answer to the problem is not enough for 100 points , your answer has to be scalable and optimized in order to get 100 points.

How to make your programs scalable and optimized ?

That is the whole point of competitive programming. You will have to read up extensively on data structures and algorithms , understand what sort of logic to use where , etc. All of this will come from practice and study.

I hope I was of help , if anything is unclear comment and I will try to help you out as good as I can :)

link

answered 30 Sep '17, 02:56

my_name_is_nrg's gravatar image

4★my_name_is_nrg
826
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×31
×26
×13

question asked: 29 Sep '17, 20:29

question was seen: 879 times

last updated: 30 Sep '17, 02:56