"I want to ask a question" - Ask them all here!

How to guess whether code will run in given time or not or will run for specific input (such as large size array)?

Try learning about big O notation and time complexity. You canc heck geeksforgeeks for this. Roughly, judge executes ~K x 10^7 instructions a second. If N is upto 10^5, then a O(N^2) algorithm will fail as it needs atleast 10^5 x 10^5 = 10^10 instructions.

In the question Lazy Jem, I cant get outputs like 131351258112.I’m programming in C.Can anybody please teach me how to store large numbers in an array? Please help me.

There is a tutorial for this by @kuruma . Search for it.

https://www.codechef.com/viewsolution/15482446.This is my attempt at Discrepancies in the Voters List.I’m getting a TLE.Please help me!!.This is urgent.(for me)

You dont even need to sort. Just maintain a frequency array, and if any element is coming more than once (2 or 3 times) then include it in answer array. If you go sequentially you wont need to sort answer array as well.

Thank you. :smiley:

You no longer need to rely on this thread for answers. You can use “ask the question” feature now. :smiley:

I’m a beginner at java. I wanted to know how the nextLine() Method discards your current input? For example assume the following code:

{
Scanner input = new Scanner(System.in);

int a = input.nextInt();

input.next();
}

After the input.next() is executed, the value in “input” is discarded. I wanted to know how does it work?

pls help guys

You may want to refer to stackoverflow for this question.

i tried but cant get satisfactory ans. i hope will get a help from here

thanks anyway

link : https://stackoverflow.com/questions/24374730/how-does-nextline-discard-the-input

Its not exactly “discarded”. Its just that there is no variable which is accepting the value, so the scope of the value in “input.next()” ends.

nextLine method doesnt discard the input, it takes the entire line as input. In case again, theres no string to accept that, the input is wasted and it starts reading from next line.

can anyone please tell me whats wrong with my code?

problem: https://www.codechef.com/problems/FLOW007

my code: https://www.codechef.com/viewsolution/15871446

thx in advance.

HI all,how to report for this question?
The picture in the question is not showing.

Question

The issue has been forwarded to @admin. Thanks.

Try this case-

Input- 90
Expected output = 9. If 09 printed, give WA.

Similarly Input=900000000 ,output=9. Leading 0 are not allowed.

can anyone please tell me whats wrong with my code?

problem : https://www.codechef.com/problems/PRB01

code: https://www.codechef.com/viewsolution/15878569

Please print “yes” and “no” isntead of “YES” and “NO”. Wrong case= Wrong Answer.

can anyone tell me what wrong in my codes?

  1. problem : https://www.codechef.com/problems/HEADBOB
    CODE: https://www.codechef.com/viewsolution/15878756

  2. (got 40 points) problem: https://www.codechef.com/problems/SMPAIR
    CODE: https://www.codechef.com/viewsolution/15878167

In the score based ranking system(in Long Contests), whose name appears first in case of ties?? I know it doesnt matter as ranks are similar, just asking out of curiosity coz its neither alphabetical wise nor rating wise.