October LunchTime UNofficial Editorials (First two problems) Revised

I’m getting WA in the second subtask in BUGCAL… Why?

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

My solution is in O(number of digits). I don’t know why it is giving TLE. This is my solution.
It is in Python. My logic is I calculate the number if I remove one digit, and check if it is divisible by 6 and greater than previously held value and replace it. Then append zeroes according to input if the first digit is removed.

e.g:- 3268398 is input,
num will hold the values (268398, 368398, 328398, 326398, 326898, 326838, 326839) in each iteration respectively.
Will check if it is divisible by 6 and greater than previously divisible value.

Thanks in advance.

I don’t know why i am getting RE(NZEC)?
this is my solution https://www.codechef.com/viewsolution/15995869

My code gives wrong ans.Any test case where it may fail?
link:https://www.codechef.com/viewsolution/16002121

for the second question ,every test case i checked is satisfied still i am getting a wrong answer please help me out pointing out just 1 test case that this code cannot run ??

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

@taran_1407 can you give some testcases for 2nd question.

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

What is wrong in this code for BUGCAL? PLease help. Everything handled!

@shivam2296 When you are swapping a&b then you should also swap the length also.

Taran, Can you help me debug my code? It seems like I’m missing some corner cases.

Edit: I’m sorry. The link was wrong. This is link to solution. https://www.codechef.com/viewsolution/16002813

Hey @shivam2296 ur code showing wrong for a.length<b.length

Example:
input:

2

11 1145

12 13456

output:

-)

)9

plzz join fb group:https://www.facebook.com/groups/1232901383475983/

Hey taran I am getting wa for the 2nd subtask in the problem BUGCAL. Any testcase where I might fail. Here’s the link to my solution - link text

you are getting -1 for 66666666666

Your Code gives wrong input for

1

99999999 99999999

output:
88888880

But Unable to figure out the exact reason for WA

@taran_1407 @vijju check out this code why showing wrong

it’s showing Acess Denied :frowning:

Thats because of pow10 function, which stores result in double. Due to precision loss of ~{10}^{-8}, it shows deviation at large values.

1 Like

Ur code printing leading Zeroes!!

Mate, you are complicating your life a lot by using that vector V. Simply check for digit remainder 3 during a loop, check if sum%3 == d%3. It will give same reaults.

Refer to my implementation and feep free to ask anythibg… :slight_smile:

A must know thing for python coders. When dealing with large number, Even basic arithmetic operations like remainder cost time proportional to number of digits, making your solution O(N^2).

Feel free to ask anything…

Mate, you cannot take a number greater than or equal to 2^31 or smaller than -2^31 as int in java.

Take input as

String p = obj.next();

Feel free to ask anything… :slight_smile: