×

# ZCO 2014 Smartphone

 0 Why is my code not getting accepted even when i have tested all selfmade testcases to be running correctly My code is at given link- link asked 08 Nov '15, 11:57 9●1●4 accept rate: 0%

 0 When I opened your code I got a TLE. You are complicating it a little too much. There is a logic in this question which is actually very simple. The maximum profit will always be a multiple of one of the customers budget. answered 12 Nov '15, 19:37 2★asc4155 1 accept rate: 0%
 0 The problem is in your merge function. You are arbitrarily declaring an array of 100 size. The constraints are lot higher. Also change all your int's to long long to avoid danger. See here all same with the above changes implemented. answered 12 Nov '15, 22:52 3★virresh 140●4 accept rate: 37% Yes , you are right , the problem is in the merge function because of size of the array being 100. That is because it is running correctly because when i give about input of size 10 - 20. Thanks (15 Nov '15, 18:08)
 0 tomorrow is exam so you shall use one thing it will save your time. Use algorithm.h it has various functions such as sort() it will sort your array and you won't have to worry for sorting part. example int A[5]={7,6,4,8,1}; sort(A+0,A+4); answered 14 Nov '15, 20:07 29●5 accept rate: 0%
 0 @asc4155 is right. You are overcomplicating it. Here's my code that fetched me 100 points https://ideone.com/wm4sDz answered 14 Nov '15, 21:17 2★yash97 1 accept rate: 0%
 0 What's wrong with my code (excluding the slow sorting algorithm)? https://ideone.com/pKbqZh answered 15 Nov '15, 16:15 1●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:

×427
×399
×247
×24

question asked: 08 Nov '15, 11:57

question was seen: 2,341 times

last updated: 15 Nov '15, 18:08