Help

Pages: 123
Jun 8, 2019 at 9:25pm
what should be the answer of n=1 and k=6 ?
PLz explain also..
Jun 8, 2019 at 9:30pm
UPDATE: I got AC, was making a silly mistake.

@lame , read the question properly, n>=2 is a constraint, if n was 1, the answer would be infinite.

also please refer to @blackmamba 's reply, he has given a good explanation which is way more than enough to solve the problem. its simple. just look for the PATTERN.
Jun 8, 2019 at 9:30pm
N>=2 as stated in problem
Jun 8, 2019 at 9:34pm
according to the pattern i m getting two cases:

for n=2 and rest of the cases.

Is my approach right ?
Jun 8, 2019 at 9:44pm
first try for n=2, you'll see an obvious pattern, then try for n=3, and so on.. pattern will be much clearer then
Jun 8, 2019 at 11:09pm
is there any corner case...I m getting second subtask wrong.
Jun 9, 2019 at 1:22am
okay
Last edited on Jun 9, 2019 at 7:42am
Jun 9, 2019 at 7:43am
closed account (STD8C542)
ok
Last edited on Jun 10, 2019 at 10:51am
Jun 10, 2019 at 6:52am
@theKlaw Please provide me that test case bro
Last edited on Jun 10, 2019 at 10:19am
Jun 10, 2019 at 12:58pm
@iotaa and @blackmamba and @theKlaw

Can u explain this problem for n=3 and k=2 ?

According to me there are infinite number of unreachable points.

For above case: starting with 2,4,6,8,10............ in this case we are getting only even numbers.
Jun 10, 2019 at 1:24pm
>
Can u explain this problem for n=3 and k=2 ?

initially chef has infinite amount of k to k+n-1 (inclusive).
so for k=2, n=3, chef initially has 2,3,4.
only 1 is unreachable by those values.
Jun 10, 2019 at 1:32pm
@anup30 did you get AC in sub task 1 ? Can you give me a hint

Last edited on Jun 10, 2019 at 1:33pm
Jun 10, 2019 at 1:37pm
@TheTimes i got AC in sub task 1
did you get AC in subtask 2?
Last edited on Jun 10, 2019 at 1:37pm
Jun 10, 2019 at 1:41pm
@Dum Yeah , I directly applied %M to final sum . It gave me all AC except the subtask 1.Whats your approach?
Jun 10, 2019 at 2:00pm
@TheTimes Can you give me some testcase
Jun 10, 2019 at 2:04pm
@Dum k = 7 and n = 3
Jun 10, 2019 at 2:08pm
2
large cases bro not small
Last edited on Jun 10, 2019 at 2:09pm
Jun 10, 2019 at 2:16pm
It's small bro , 7 8 9 14 15 16 17 18 21 22 23 24 25 26 27 28 29 30 ...etc
as you can see Missing numbers are :
1 to 6 - 6
10 to 13 - 4
19 to 20 -2
So you can see a AP series with 6 , 4, 2
with common difference -2 i.e nothing but n -1
Jun 10, 2019 at 2:18pm
yeah i did the same but 2nd case in 2nd subtask is failing
Jun 10, 2019 at 2:19pm
you said you are getting wa in 1st sub task right
so better put this if n == 2 then print n*(n+1)/2
Pages: 123