A little hint: You should be able to answer each query in O(2^W) based on the result of a DP, where W is the number of coins, which is always 4 in this problem.
i.e. After running a DP, you should answer each query in almost constant time.
Search found 274 matches
- Sat Aug 04, 2007 10:29 pm
- Forum: Volume 112 (11200-11299)
- Topic: 11259 - Coin Changing Again
- Replies: 12
- Views: 5629
- Mon Jul 30, 2007 3:40 pm
- Forum: Volume 112 (11200-11299)
- Topic: 11248 - Frequency Hopping
- Replies: 20
- Views: 10809
- Sun Jul 29, 2007 12:05 pm
- Forum: Volume 112 (11200-11299)
- Topic: 11248 - Frequency Hopping
- Replies: 20
- Views: 10809
11248 - Frequency Hopping
Two clarifications requested: Would there be more than one edge connecting the same pair of stations? i.e. Are the following valid test cases? 2 2 2 1 2 1 1 2 1 2 2 3 1 2 1 1 2 2 0 0 0 ... print all pairs of stations (in ascending order) ... This is somehow ambiguous to me. Ascending order of the ed...
- Mon Jul 16, 2007 8:28 am
- Forum: Other words
- Topic: Migration
- Replies: 5
- Views: 4199
- Mon Jul 16, 2007 6:33 am
- Forum: Other words
- Topic: Migration
- Replies: 5
- Views: 4199
- Sun Jul 15, 2007 5:05 am
- Forum: Other words
- Topic: Migration
- Replies: 5
- Views: 4199
- Fri Nov 03, 2006 1:40 am
- Forum: Volume 111 (11100-11199)
- Topic: 11139 - Counting Quadrilaterals
- Replies: 13
- Views: 6254
- Thu Oct 19, 2006 4:44 am
- Forum: Volume 111 (11100-11199)
- Topic: 11123 - Counting Trapizoid
- Replies: 16
- Views: 6966
Hmm.. your answer is a little confusing to me...
So there could be duplicated points, right?
If so, what should be the output of this case?
1? or 2?
So there could be duplicated points, right?
If so, what should be the output of this case?
Code: Select all
5
0 0
0 0
1 0
1 1
0 2
0
- Wed Oct 18, 2006 5:24 pm
- Forum: Volume 111 (11100-11199)
- Topic: 11123 - Counting Trapizoid
- Replies: 16
- Views: 6966
- Wed Sep 27, 2006 4:27 pm
- Forum: Volume 107 (10700-10799)
- Topic: 10798 - Be wary of Roses
- Replies: 58
- Views: 24211
2DJWS wrote:What is the answer of this case:Is it 1? Or 2?Code: Select all
5 RRRRR RRRRR ..P.. ..... .....
- Fri Sep 15, 2006 7:18 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11079 - What's the Time?
- Replies: 8
- Views: 4497
- Thu Sep 14, 2006 5:47 am
- Forum: Volume 110 (11000-11099)
- Topic: 11081 - Strings
- Replies: 35
- Views: 23810
Currently the dp table si 2*60*60*60 (it's 4 parameters: t,x,y,z) If we can remove 't', then the table is 60*60*60 (absolutely twice faster). The memory is absolutely reduced by half but the run time is not necesarily absolutely twice faster. The recurence for the dp[2][60][60][60] looks quite simp...
- Wed Sep 13, 2006 7:10 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11081 - Strings
- Replies: 35
- Views: 23810
Re: Is there away to only use 3 parameters instead of 4?
Is there away to only use 3 parameters instead of 4? Yes, and it's actually possible to reduce further to 2 dimensional array. I saw in the problem ranklist, there are people who AC in 2.xxx secs.. it's about twice as fast as the DP talked above and I think because their DP doesn't have the 't' par...
- Tue Sep 12, 2006 5:01 am
- Forum: Volume 110 (11000-11099)
- Topic: 11082 - Matrix Decompressing
- Replies: 28
- Views: 14521
- Mon Sep 11, 2006 8:42 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11093 - Just Finish it up
- Replies: 14
- Views: 10104