You are not logged in. Please login at to post your questions!


For DISHOWN July14 same solution in C++ 4.3.2 got TLE & got AC in C

For the problem DISHOWN in JULY14 challenge I first tried in C++ 4.3.2 and got TLE then I uploaded the same code(of course changed cin & cout to scanf and printf) got AC in C.

Admin/Anyone please exlain the reasons for this:

C++ 4.3.2 Submission(TLE):

C Submission(AC):

Thank's in Advance.

asked 16 Jul '14, 13:35

codeman004's gravatar image

accept rate: 25%

edited 01 Aug '14, 14:20

admin's gravatar image

0★admin ♦♦

Yes 'cin' and 'cout' are slower than scanf() and printf().To make them faster you can use :

int main() {
     ios_base::sync_with_stdio(false); cin.tie(0);
    // rest of your code
    return 0;

Here are some of the links which may help you !


answered 16 Jul '14, 13:45

achaitanyasai's gravatar image

accept rate: 10%

@achaitanyasai Does that difference(cin & cout to printf & scanf) will cause this much effect I mean TLE to AC..??

(16 Jul '14, 13:48) codeman0044★

It depends, if the constraints are tight(large) then you may have chance to get TLE if you use cin/cout. But in most of the cases it doesn't matter.

(16 Jul '14, 13:50) achaitanyasai5★

@achaitanyasai Thanks.. :)

(16 Jul '14, 13:53) codeman0044★
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 16 Jul '14, 13:35

question was seen: 1,002 times

last updated: 01 Aug '14, 14:20