×

# How to resolve time limit exceed error from my program

 0 http://www.codechef.com/problems/TSORT/ include #include using namespace std; int main() { int n; cin>>n; int s[n]; for(int k=0;k>s[k]; sort(s,s+n); for(int m=0;m

 2 It's getting TLE due to slower I/O. Using scanf and printf this solution will get AC. Accepted code This problem can also be solved using counting sort in O(n) time. C++ implementation answered 06 Dec '14, 11:25 3★gautam94 474●14●26●46 accept rate: 11% Thanks finally get my code accepted!! (06 Dec '14, 13:13) Why i getting code accepted in this case http://www.codechef.com/viewsolution/5503082 and not in that case due to time limit exceeded although these are same http://www.codechef.com/viewsolution/5503067 Plz help me!! (06 Dec '14, 13:49) 2 @chaman_amit If you got the answer for your question,then you should mark it as the correct answer,so that it won't appear in unanswered questions. :) (06 Dec '14, 14:03) I won't find any option to mark as correct answer , plz tell me so i ll do that!! (06 Dec '14, 15:44)
 0 https://www.codechef.com/viewsolution/17473205 Can anyone please explain me why it is giving TIME LIMIT EXCEEDED ? answered 18 Feb '18, 21:58 1 accept rate: 0%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×204
×40
×38

question asked: 06 Dec '14, 10:01

question was seen: 11,244 times

last updated: 18 Feb '18, 21:58