Search found 13 matches

by gush
Sun Nov 06, 2005 1:21 pm
Forum: Volume 109 (10900-10999)
Topic: 10949 - Kids in a Grid
Replies: 30
Views: 11890

Hi gush, You don't have to actually store all pairs first before processing them. If you make sure you generate them in the sorted order (first by increasing x, then increasing y), you can directly 'insert' them while you generate them. Inserting, in the terms of Skiena, meaning maintaining an arra...
by gush
Sun Nov 06, 2005 2:52 am
Forum: Volume 109 (10900-10999)
Topic: 10949 - Kids in a Grid
Replies: 30
Views: 11890

OK, I finaly got it using the algorithm mentioned by Skiena. For the case above, my program takes 5 or 2 seconds, dependent on the order in which you compare the strings, which is about 10 and 4 seconds on the judge, resp. So we may safely assume that the judges input doesn't contain such 'horror' ...
by gush
Sat Nov 05, 2005 4:49 am
Forum: Volume 109 (10900-10999)
Topic: 10949 - Kids in a Grid
Replies: 30
Views: 11890

I got Accepted with an O(p*(n-p)) Algorithm, where p is length of LCS. I found this algorithm in a paper with the subject: "A New Flexible Algorithm for the Longest Common Subsequence Problem". But I think there must exist a better algorithm for this specific problem, maybe you can use the informat...
by gush
Sat Nov 05, 2005 4:41 am
Forum: Volume 109 (10900-10999)
Topic: 10949 - Kids in a Grid
Replies: 30
Views: 11890

OK, I finaly got it using the algorithm mentioned by Skiena. For the case above, my program takes 5 or 2 seconds, dependent on the order in which you compare the strings, which is about 10 and 4 seconds on the judge, resp. So we may safely assume that the judges input doesn't contain such 'horror' ...
by gush
Wed Nov 02, 2005 6:52 am
Forum: Volume 109 (10900-10999)
Topic: 10952 - Pattern Transformations
Replies: 22
Views: 4343

has this problem been fixed yet?
by gush
Thu Aug 11, 2005 10:57 am
Forum: Volume 108 (10800-10899)
Topic: 10885 - Martin the Gardener
Replies: 23
Views: 6690

ok
by gush
Wed Aug 10, 2005 11:55 am
Forum: Volume 108 (10800-10899)
Topic: 10885 - Martin the Gardener
Replies: 23
Views: 6690

All the points are on the same circle. So there should be no 3 points in the same line.
by gush
Wed Aug 10, 2005 10:42 am
Forum: Volume 108 (10800-10899)
Topic: 10885 - Martin the Gardener
Replies: 23
Views: 6690

This is my answer:
....
I've tested that the distances between them are integers. But I still got WA. Why?
by gush
Fri Dec 12, 2003 3:55 pm
Forum: Volume 105 (10500-10599)
Topic: 10561 - Treblecross
Replies: 26
Views: 11368

the output should be as follows. WINNING 3 LOSING WINNING 3 WINNING 1 12 15 17 20 24 28 31 33 36 47 WINNING 3 5 WINNING 4 10 16 22 23 33 34 35 37 38 39 49 50 51 WINNING 17 20 WINNING 1 4 5 6 9 WINNING 3 6 WINNING 3 WINNING 11 WINNING 12 WINNING 3 12 WINNING 13 16 LOSING WINNING 12 15 WINNING 11 WINN...
by gush
Fri Dec 12, 2003 3:55 pm
Forum: Volume 105 (10500-10599)
Topic: 10561 - Treblecross
Replies: 26
Views: 11368

the output should be as follows. WINNING 3 LOSING WINNING 3 WINNING 1 12 15 17 20 24 28 31 33 36 47 WINNING 3 5 WINNING 4 10 16 22 23 33 34 35 37 38 39 49 50 51 WINNING 17 20 WINNING 1 4 5 6 9 WINNING 3 6 WINNING 3 WINNING 11 WINNING 12 WINNING 3 12 WINNING 13 16 LOSING WINNING 12 15 WINNING 11 WINN...
by gush
Wed Dec 10, 2003 4:05 pm
Forum: Volume 105 (10500-10599)
Topic: 10501 - Simplified Shisen-Sho
Replies: 12
Views: 8569

just use DFS
by gush
Mon Dec 08, 2003 5:26 pm
Forum: Volume 105 (10500-10599)
Topic: 10559 - Blocks
Replies: 37
Views: 12261

color[z] must be defferent from color[z + 1] and
color[z + 1] should be the same as color

thus, we can use 3-dim array to store the data.
D[a][l] : form a to b, the len of the last seg clicked out is l, and of course the color of the seg is color.
by gush
Wed Oct 15, 2003 7:56 am
Forum: Volume 105 (10500-10599)
Topic: 10531 - Maze Statistics
Replies: 8
Views: 5021

Per, could you please tell us how to solve this problem efficiently? I can't avoid TLE.

Go to advanced search