I was coding for a particular problem whose time limit was 2 seconds.. The no. of input was max 300000. Simply taking in the number using cin and outputting the same number with cout will take more than 2 seconds.
Any ideas on how to increase efficiency??
catchmrbharath 0 Light Poster
Recommended Answers
Jump to Post— ArkM 1,090What's this input source?
What's the output target?
Jump to Post— s_sridhar 7I'm not sure, but instead of using cout, try placing it directly in the video memory(0x40000000). printf is more time efficient than cout, because in cout the datatype is not mentioned
Jump to Post— siddhant3s 1,429Simple, Use file I./O.
Or you can also use the input redirection operator '<' while calling the program from the command prompt$ myprogram.exe < input_data.txt
Jump to Post— ArkM 1,090>try placing it directly in the video memory...
30000 numbers per second... in video memory...
May be, 30000 numbers per second directly from the keyboard?...
;)
Jump to Post— tux4life 2,072>try placing it directly in the video memory(0x40000000)
Haha, directly!
I assume the OP isn't using DOS anymore :P
All 18 Replies
ArkM 1,090 Postaholic
s_sridhar 7 Junior Poster
siddhant3s 1,429 Practically a Posting Shark
ArkM 1,090 Postaholic
tux4life 2,072 Postaholic
catchmrbharath 0 Light Poster
ArkM 1,090 Postaholic
lss123 19 Newbie Poster
siddhant3s 1,429 Practically a Posting Shark
Narue 5,707 Bad Cop Team Colleague
siddhant3s 1,429 Practically a Posting Shark
Narue 5,707 Bad Cop Team Colleague
ArkM 1,090 Postaholic
catchmrbharath 0 Light Poster
ArkM 1,090 Postaholic
MosaicFuneral 812 Nearly a Posting Virtuoso
s_sridhar 7 Junior Poster
s_sridhar 7 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.