I need help. Please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 25

I need help. Please

Is it even possible to input 3 numbers with the time less than 1 second? I am participating in some competition, and the time limit is 1 sec, that's why I am asking. If anyone here knows how can you help?

18th Feb 2017, 12:22 PM
Filip
Filip - avatar
24 Answers
+ 24
It isn't, as I said, it is just written like this "Time limit: 1second"
18th Feb 2017, 1:30 PM
Filip
Filip - avatar
+ 22
3 random numbers, yes, it has to be a human
18th Feb 2017, 1:24 PM
Filip
Filip - avatar
+ 21
Maybe, I hope :)
18th Feb 2017, 1:13 PM
Filip
Filip - avatar
+ 20
Not that, time elapsed in program, that'a what I am asking about
18th Feb 2017, 12:26 PM
Filip
Filip - avatar
+ 20
I don't know, it just says time limit is 1sec, I haven't figured it out yet. Maybe the time is after the input section?
18th Feb 2017, 12:58 PM
Filip
Filip - avatar
+ 19
I am limited to standard input, so... My code executes in less than 10ms when I give values, but with input, for example cin, it is extended to 1+ second(s)
18th Feb 2017, 12:36 PM
Filip
Filip - avatar
+ 19
Input 3 integers, and then do some things, but just inputing part takes more than 1 second :(
18th Feb 2017, 1:05 PM
Filip
Filip - avatar
+ 13
Well…… Java has threads with methods sleep() and wait(). Not sure about C++ though…… ~_~
18th Feb 2017, 12:37 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 12
filip rotate your profile picture 90 ° right
25th Feb 2017, 9:56 PM
code
code - avatar
+ 9
Did you figure it out, or do you still have problems?
18th Feb 2017, 12:55 PM
J.G.
J.G. - avatar
+ 8
Hmm... Something seems wrong here. My guess would be that it doesn't count the time it takes to input the three numbers.
18th Feb 2017, 1:13 PM
J.G.
J.G. - avatar
+ 8
Well, then, I don't know what else it could be. It would be really unfair to include program input time. Is it specified how the time is measured?
18th Feb 2017, 1:29 PM
J.G.
J.G. - avatar
+ 7
The time limit includes the time it takes to input the 3 values?
18th Feb 2017, 12:39 PM
J.G.
J.G. - avatar
+ 7
Well, sorry. I don't know know I can help on this one. But good luck, and just try to input the numbers fast. :)
18th Feb 2017, 1:37 PM
J.G.
J.G. - avatar
+ 7
If you get to input the numbers, then you could just input the same number. This could possibly get the time down to around 1/3 to 1/2 sec.
18th Feb 2017, 1:40 PM
J.G.
J.G. - avatar
+ 7
@Filip Sir, It is the compilation time. I have been to such a competition where they specified the time limit as the time taken to compile your code by the IDE you're using... That's why I never use TC++... C::B shall neatly display you the compilation time as well as the execution time, which takes 2+ seconds due to cin...
10th Apr 2017, 8:53 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 6
Well, what are the requirements? Does the code have to execute something after each input? Or does it use them all at the same time? Or maybe there is a link that you could provide?
18th Feb 2017, 1:02 PM
J.G.
J.G. - avatar
+ 6
What kind of numbers do you have to input? The same ones or random ones? And does it have to be a human that inputs the numbers?
18th Feb 2017, 1:22 PM
J.G.
J.G. - avatar
+ 6
Actually, the time limit you are talking about it's the runtime of the program according to given inputs. Assuming you are participating in a programming contest, you can be assured that the inputs will be given to the program using a script from an input file and the outputs will be compared with the outputs of an output file. So, don't worry about that.
20th Feb 2017, 4:55 AM
Dimhat
+ 4
Without knowing the full details of the problem, all we can do is make assumptions.
20th Feb 2017, 5:43 AM
The Artist Formally Known as Jeremy
The Artist Formally Known as Jeremy - avatar