Search found 28 matches

by kn
Sun Feb 15, 2009 9:49 pm
Forum: Volume 115 (11500-11599)
Topic: 11573 - Ocean Currents
Replies: 12
Views: 3675

Re: 11573 - Ocean Currents

Thanks for your hint!
I finally got it AC in 1.0xx sec.

I use BFS in my final implementation

Complexity : O(1000*1000)
by kn
Sun Feb 15, 2009 2:48 pm
Forum: Volume 115 (11500-11599)
Topic: 11573 - Ocean Currents
Replies: 12
Views: 3675

Re: 11573 - Ocean Currents

> junrajz I used the same algorithm as you described. It got accepted in 0.65 s without any optimization. Maybe some flaw in your code. ----- Rio Rio, would you please describe your codes in details? e.g. the graph representation, STL used, the while loop of Dijkstra... I wonder why my code has suc...
by kn
Sun Feb 15, 2009 1:45 pm
Forum: Volume 115 (11500-11599)
Topic: 11573 - Ocean Currents
Replies: 12
Views: 3675

Re: 11573 - Ocean Currents

What heap did you use?
Heap of (Dist, x, y) ?

I use Heap of (Dist, z) (using C++ STL - priority_queue)
where z is encoded by x and y
and got accepted in 2.9xx -_-

I tried using Heap of (Dist, x, y) and got TLE for several attempts.

Hope it helps.
by kn
Tue Feb 03, 2009 9:50 pm
Forum: Volume 112 (11200-11299)
Topic: 11210 - Chinese Mahjong
Replies: 10
Views: 5235

Re: 11210 - Chinese Mahjong

Let me explain a little bit of my algorithm: First of all, I use 13-bit-pattern to represent a combination. e.g. 1110011100000 means 1+2+3+6+7+8 piece. Algorithm: 1) I search for "Chow" and "Pong" (3 pieces), store them in vector<int> a3. 2) Then I search for pair (2 pieces), store them in vector<in...
by kn
Wed Jan 28, 2009 11:54 pm
Forum: Volume 112 (11200-11299)
Topic: 11210 - Chinese Mahjong
Replies: 10
Views: 5235

Re: 11210 - Chinese Mahjong

Hi guys, I have been trying different test cases for many times... My code passed all available test cases, and I have been checking the code again and again... but I still don't have any idea on how my program could be wrong. Would anyone please take a look on my code? The comment should be clear e...
by kn
Mon Feb 11, 2008 5:02 pm
Forum: Volume 104 (10400-10499)
Topic: 10400 - Game Show Math
Replies: 32
Views: 17655

I am aquainted with Bit masking concept.. but here in this situation, i could not imagine how bits can be used to mark the reached position ( as mentioned by Adrian ) if we do it by an array we need a 64000 x 100 size of array.. but masking can be done only for integers upto 64. Can anybody explain...
by kn
Mon Jul 30, 2007 6:20 pm
Forum: Volume 101 (10100-10199)
Topic: 10104 - Euclid Problem
Replies: 29
Views: 10010

jan_holmes wrote:
input :
0 5
89 56
89 446
1555 169777
150 3005
output :
0 1 5
17 -27 1
-5 1 1
-21072 193 1
-20 1 5
Hope it helps... :D
Second requirement in the problem is "X <= Y"
But the 3rd output violates that....
by kn
Fri Jun 22, 2007 2:10 pm
Forum: Volume 103 (10300-10399)
Topic: 10378 - Complex Numbers
Replies: 25
Views: 13520

Your code prints -0.000 in some cases. Just check your output carefully for the following input set. Input: 88+1i 50 2+56i 79 I used almost similar method, but my printing method was different. The idea is to first print the values in a string and then scan from the string. void print(double a,doub...
by kn
Fri Jun 22, 2007 12:37 pm
Forum: Volume 4 (400-499)
Topic: 429 - Word Transformation
Replies: 82
Views: 17156

Well... in your test case, words are not in a lexicographical order, which is assumed in the specification of the problem I did take this assumption in solving the problem Read the description again... all words will be alphabetic and in lower case, and no word will be longer than ten characters. W...
by kn
Thu Jun 21, 2007 7:55 pm
Forum: Volume 4 (400-499)
Topic: 429 - Word Transformation
Replies: 82
Views: 17156

hello... i didn't see ur code...but ur program gives output for 2 aaa bbb aab aba abb a b * aab bbb abc abd aaa aab abb * abb aab abc abd aab bbb aab abb 1 abb aab 1 abb abb 0 aab abb 1 :roll: is it correct?? Well... in your test case, words are not in a lexicographical order, which is assumed in t...
by kn
Thu Jun 21, 2007 4:25 pm
Forum: Volume 4 (400-499)
Topic: 429 - Word Transformation
Replies: 82
Views: 17156

I use binary search and 2D array to implement...
Y WA...?

Code: Select all

AC-ed
I read the question wrong again.. :( 
by kn
Wed Jun 20, 2007 9:55 pm
Forum: Volume 4 (400-499)
Topic: 453 - Intersecting Circles
Replies: 84
Views: 14979

Really tough problem... My code passed the test case provided by the other post...yet, WA Round-off problem is difficult to tackle... for this online judge. I think dealing with the round-off error "correctly" requires some "luck". BTW, why I can't search the posts of this problem after I entered "4...
by kn
Wed Jun 20, 2007 8:54 pm
Forum: Volume 103 (10300-10399)
Topic: 10378 - Complex Numbers
Replies: 25
Views: 13520

I use STL to do... why wrong?

Code: Select all

Removed...
by kn
Sun Jun 17, 2007 7:09 pm
Forum: Volume 9 (900-999)
Topic: 918 - ASCII Mandelbrot
Replies: 11
Views: 3833

Jan wrote:Your code doesn't pass the first sample. Check the first sample (13th line).

Hope it helps.
At the first time when you gave me your hint, I can't figure out why my code gave wrong output.
Now, I recognized what's wrong in my code...!

ROUND-OFF ERROR!!

Thx again, Jan :D
by kn
Sun Jun 10, 2007 7:39 pm
Forum: Volume 4 (400-499)
Topic: 439 - Knight Moves
Replies: 33
Views: 11058

Try the cases. Input: a2 b8 a2 h4 a2 h3 a2 d2 Output: To get from a2 to b8 takes 3 knight moves. To get from a2 to h4 takes 5 knight moves. To get from a2 to h3 takes 4 knight moves. To get from a2 to d2 takes 3 knight moves. Hope these help. AC Sigh...always get confused by the indexes Next time I...

Go to advanced search