Search found 9 matches

Mon Jan 31, 2005 2:31 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 187860
I'm not sure about the restricted function error, but you are getting WA because the first input is not necessarily less than the second.
Tue Dec 21, 2004 4:38 am
Forum: Algorithms
Topic: USACO help again
Replies: 5
Views: 1972
You shouldn't be using factoral to find the number of combinations. Factorial is for finding permutations, and you are looking for combinations (since order on the positions of the different 1's in multiple positions doesn't matter), so try using binomial coefficients.
Mon Dec 20, 2004 3:38 pm
Forum: Algorithms
Topic: Deikstra with heap
Replies: 5
Views: 1803
Ah, thank you for the clearup. As for time complexity, I am aware that it is O(mlogn), but the OP referenced an O(nlogn) solution so I was just trying to be consistant in illustrating the difference in the algorithms (although I was wrong about the vector<> not being used as a heap structure, as I m...
Mon Dec 20, 2004 1:21 pm
Forum: Algorithms
Topic: Finding stuff within a grid - aproaches
Replies: 3
Views: 1230
Be careful that you check for out-of bounds when you implement a dfs or bfs. Also, this problem can actually be implemented without a complicated algorithm (and is easier to code). Here is the explanation for only diagonal checks. Say there are two pieces named a and b, and you are trying to see wha...
Mon Dec 20, 2004 1:11 pm
Forum: Algorithms
Topic: Deikstra with heap
Replies: 5
Views: 1803
That implementation of Dijsktra's algorithm is not O(nlgn) since you are using a vector instead of a heap to store your data (it is O(n^2)). You can implement this correctly with a heap using the normal priority_queue data structure, but multiply all costs by -1 so that the heap is sorted correctly....
Thu Oct 07, 2004 7:35 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 51466

Re: I'm a little disappointed...

There are quite some questions that may have many equally good answers. 102 is an example. For instance: 1 2 3 4 5 6 7 8 9 All 6 possible assigning schemes - GBC, GCB, CBG, CGB, BCG, BGC - will non-exceptionally generate the same moves - 30! So these solutions should be equally treated as correct. ...
Tue Oct 05, 2004 7:11 am
Forum: Other words
Topic: What's wrong with my stats ?
Replies: 14
Views: 3700
admins: My statistics are also incorrect. It says I have only solved 4 problems...
Sat Oct 02, 2004 8:53 am
Forum: Volume 1 (100-199)