MSNG - Editorial

Take this example:

n = 5
-1 0
-1 0
-1 4

You get an infinite loop in Intersection function

Can you guarantee that those operation doesn’t occur any overflow ?

If you execute the statement a\gets a\cdot b+d, and

  • a\le 10^{12}
  • b,d\le 35

then the value a after this statement is at most (10^{12}+1)\cdot 35\ll 10^{18}, so no need to worry about overflow.

Can you please clearify these test cases ?

But some solution may not handle leading zeroes correctly. This problem does not require you to handle leading zeroes, so it’s entirely okay if they fail on your test case.

Can anyone please tell me why do I get runtime error(SIGSEGV) for problem MSNG.This code works fine in my computer but getting this error in codechef compiler…

link to my solution: CodeChef: Practical coding for everyone

Used a similar approach as the setter, still got WA. Can anyone help me over in my code ?

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

10^12 is the limit for the decimal value of the number

Can someone please explain why this statement is required?

This is to make sure that the input number is a valid base-b number. (In a valid base-b number, only digits in 0\sim(b-1) are allowed, so if c\ge b we should return “Invalid number”.)

1 Like

Why this solution (in Python) is getting WA?
https://www.codechef.com/viewsolution/27386394

Please anyone tell me what’s wrong with my code? I am getting WA.
This is the link to my code.

PLEASE HELP ME I HAVE TRIED FOR 6 DAYS AND NOT ABLE TO UNDERSTAND WHY IS MY CODE NOT WORKING

I HAVE TRIED EVERYTHING POSSIBLE AND EVERY CASE I COULD THINK OF

PLEASE SEE THESE TWO CODES

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

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

THANKING YOU IN ADVANCE

i have a question, if a number is 458001, then the minimum possible base is ‘9’ not 2. then why we are starting with 2 always?

What’s wrong with the comparison operators you used on pairs of ints?

Did u try x = 15LLU, y = 15LLU instead?

help me pls . my code giving right answer on my self made TC but when i m submitting it WA coming .
here is my solution : CodeChef: Practical coding for everyone
pls someone look over my code and find the bug in it .

i’m storing -1 instead of pow(10, 12). I’m checking this condition in my function call.

Could anyone tell me whats wrong with my code…i have used exactly the same concept
https://www.codechef.com/viewsolution/27335116

Thanks in advance!!

Please help me
I cannot find where are the problems?
Thanks in advance.
Here is my code
https://www.codechef.com/viewsolution/27438385

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

Here is my solution. I dont know where i am going wrong. People say life is short and this problem will take up half of it if i dont get where i am going wrong in this :stuck_out_tongue_winking_eye:

Why is it considered that size of nos are going to be less than 10^12 when there is not explicit mention of such constraints?
Why is multiplication of large nos using strings not used in this cases ?

Can someone give me testcases to check where my code is failing.
https://www.codechef.com/viewsolution/27815943