Tagged Questions

-9
votes
2answers
58 views

Online Judgement System - Why am I getting Wrong Answer for this thread? [closed]

Original page: http://acm.whu.edu.cn/learn/problem/detail?problem_id=1036 This should be a simple Dynamic Programming problem. I figured out the solution to be the following: int main(void) { ...
1
vote
1answer
98 views

Can we solve this using a greedy strategy? If not how do we solve this using dynamic programming?

Problem: The city of Siruseri is impeccably planned. The city is divided into a rectangular array of cells with M rows and N columns. Each cell has a metro station. There is one train running left to ...
4
votes
1answer
222 views

How do i solve this in a faster and more accurate way?

Here is the question: Ramu was a lazy farmer. He had inherited a fairly large farm and a nice house from his father. Ramu leased out the farm land to others and earned a rather handsome income. ...
0
votes
0answers
73 views

Wrong answer on SPOJ PARTY [closed]

I am trying this question for a long time and I am continuously getting wrong answer . I went through SPOJ forums and googled a lot but I am not getting a single test case which is producing wrong ...
11
votes
2answers
428 views

Bottom up set generation and ordering

Any method about any numerical methods you know which may be relevant, please post it here! Background I have an array of values for each set, and the index to each value corresponds to the set the ...
2
votes
2answers
84 views

How do we find two most-weighted routes in a grid?

We a given a weighted N*N grid W. Two robots r1,r2 start from top left and top right corners respectively. R1 has to reach to the bottom right and R2 the bottom left corners. Here are the valid ...
2
votes
0answers
144 views

Improving random memory access when random access is needed

The basic concept of what I am doing Complete coalition structure formation problem/Combinatorial auctions. Given a set of N agents, which disjoint subsets of the set of agents yields the best ...
1
vote
1answer
102 views

algorithm to save states for dynamic programming

Here's a question regarding saving states in a problem using dynamic programming. Every problem of DP saves results and use them further to reduce computation. Let's say, we calculate function ...
0
votes
2answers
166 views

Trying to save command line arguments in a dynamic array in C [closed]

My ultimate goal for this assignment is to create a graph data structure using adjacency list. The command line arguments will the be in the format "A B 3", where and A and B are two vertices and 3 ...
0
votes
2answers
171 views

Dynamic Programming Issue - Fibonacci Sequence

I was reading this Wikipedia article, and attempting to implement a 'map' based solution in C, where a 'map' is just an int array, initialized to 0. For some reason it works up to fib(93), then ...
0
votes
3answers
181 views

Memorization or Tabulation approach for Dynamic programming

There are many problems that can be solved using Dynamic programming e.g. Longest increasing subsequence. This problem can be solved by using 2 approaches Memorization (Top Down) - Using recursion ...
1
vote
4answers
125 views

implement DP for a recursive function

I have the following recursive function: typedef unsigned long long ull; ull calc(ull b, ull e) { if (!b) return e; if (!e) return b; return calc(b - 1, e - 1) + calc(b - 1, e) - calc(b, e - ...
-3
votes
1answer
319 views

TLE to HOTELS (spoj) [closed]

I am doing a problem of spoj i tried to do it but I am always getting TLE(time limit expired ) the question is Hotels . this is my code , please can you tell me the way to optimize it. ...
0
votes
3answers
378 views

Dynamic Programming Tiles

http://www.spoj.pl/problems/GNY07H/ In this question we have to find number of ways to arrange 2X1 tiles in 4Xw (w >=1) rectangle ? I have tried this question and has given much time to it but was ...
6
votes
2answers
702 views

Algorithm to find maximum sum of elements in an array such that not more than k elements are adjacent

I came across this question. Given an array containing only positive values, you want to maximize the sum of choosen elements under the constraint that no group of more than k choosen elements are ...

1 2
15 30 50 per page