Search found 143 matches

by angga888
Fri Jun 11, 2004 7:45 am
Forum: Volume 101 (10100-10199)
Topic: 10147 - Highways
Replies: 67
Views: 21002

Hi Tomislav, I know how to implement Prim's algorithm, but I have trouble when some edges are already given and I have to continue spanning the MST (like in this problem)... You can try this way: - Assume that cities which have already been connected by given highways as one vertex. - Also assume an...
by angga888
Thu Jun 10, 2004 8:13 am
Forum: Volume 106 (10600-10699)
Topic: 10609 - Fractal
Replies: 20
Views: 6174

How do you rotate de coordinates? I never heard of it. I use the following formula: (x'-p)=(cos@ -sin@)(x-p) (y'-q) (sin@ cos@)(y-q) so: x' = cos@ * (x-p) - sin@ * (y-q) + p y' = sin@ * (x-p) + cos@ * (y-q) + q Assumption: x = x-coordinate of the point you want to rotate. y = y-coordinate of the po...
by angga888
Wed Jun 09, 2004 7:28 am
Forum: Volume 106 (10600-10699)
Topic: 10666 - The Eurocup is Here!
Replies: 7
Views: 2590

I don't think your input is valid, since it has only 19 cases (not 20 as given in the first line). Also, according to the problem description, N is always smaller than 31. Thus there won't be cases like "31 1024". Yeah, you're right Observer. Please, ignore the last line of my output. :oops: My pro...
by angga888
Wed Jun 09, 2004 6:20 am
Forum: Volume 106 (10600-10699)
Topic: 10666 - The Eurocup is Here!
Replies: 7
Views: 2590

hi, the output :

Code: Select all

2 2147482625
2 1073740801
2 536868865
8 268435449
1 1
2 16
2 15
3 16
2 13
3 15
4 16
2 9
3 16
3 15
4 16
3 13
4 16
4 15
5 16
5 31
Anggakusuma
by angga888
Wed Jun 09, 2004 6:08 am
Forum: Volume 106 (10600-10699)
Topic: 10609 - Fractal
Replies: 20
Views: 6174

Hi lobow, I assume that the equilateral triangle always on the left side. I just try it and get the same result as the sample output. The problem description doesn't specify that. To get the points in an equilateral triangle, first I rotate the coordinates so that they become parallel to the x-axis ...
by angga888
Tue Jun 08, 2004 11:10 am
Forum: Volume 106 (10600-10699)
Topic: 10666 - The Eurocup is Here!
Replies: 7
Views: 2590

hi,

my AC solution outputs:

Code: Select all

1 1
2 1073740801
6 33554431
4 1021
3 4095
hope it helps :wink:


Anggakusuma
by angga888
Tue Jun 08, 2004 8:54 am
Forum: Volume 104 (10400-10499)
Topic: 10405 - Longest Common Subsequence
Replies: 103
Views: 29992

Hi, i tried with gets instead of cin...it can handle null strings...i also submit my program as C instead of C++...but now i get Runtime Error (SIGSEGV) after 0.316 seconds of execution.... wat's the error supposed to mean? thanx I'm suspicious with this fragment: for (i=0;i<blen;i++){ last=pos[i]; ...
by angga888
Tue Jun 08, 2004 6:59 am
Forum: Volume 104 (10400-10499)
Topic: 10405 - Longest Common Subsequence
Replies: 103
Views: 29992

hi,
i think the problem is with my way of reading input cos i ran a lot of test cases and my algo seems fine...
Have you consider about empty lines?

Input :

Code: Select all

a


a
Output :

Code: Select all

0
0
I think your program can't handle such cases.

Hope it helps :wink:


Anggakusuma
by angga888
Thu Jun 03, 2004 7:02 am
Forum: Volume 104 (10400-10499)
Topic: 10405 - Longest Common Subsequence
Replies: 103
Views: 29992

Hi babu_nothing,

The input can contain empty strings.
Change scanf() into gets(), and you will get AC. :wink:

Code: Select all

while(gets(s1))
   {
      gets(s2);
      ...
   }

Anggakusuma
by angga888
Wed Jun 02, 2004 7:44 pm
Forum: Volume 100 (10000-10099)
Topic: 10021 - Cube in the labirint
Replies: 17
Views: 3964

I think your program have some problems dealing with the wall.

Consider this case:

Code: Select all

10 3
1 1
5 2
v
4 2
5 2
h
5 2
5 1
The target coordinate is completely surrounded by walls, so the answer should be "No solution".


Anggakusuma
by angga888
Wed Jun 02, 2004 12:04 pm
Forum: Volume 100 (10000-10099)
Topic: 10021 - Cube in the labirint
Replies: 17
Views: 3964

i attempted to do this problem using a depth first traversal, but it seems to be to inefficient to solve the problem within 10s.... and looking at the timings achieved by those who solved the problem, mostly below one fifths of a sec...so there should be another more efficient approach to this prob...
by angga888
Wed Jun 02, 2004 6:56 am
Forum: Volume 7 (700-799)
Topic: 714 - Copying Books
Replies: 29
Views: 19731

Hi, I always get WA for this problem. I used Divide and Conquer recursion with memoization. I did this way : Let sum[x] be the summation of book pages from the first book to the x'th book, and sum[0]=0. long long divideandconquer(int start, int scriber) { int p; long long min,value; if (scriber==1) ...
by angga888
Tue Jun 01, 2004 7:35 am
Forum: Volume 101 (10100-10199)
Topic: 10100 - Longest Match
Replies: 95
Views: 21354

My code gives the output for the following inputs as..
You're outputs are exactly the same as mine.


Anggakusuma
by angga888
Mon May 31, 2004 8:36 pm
Forum: Volume 101 (10100-10199)
Topic: 10147 - Highways
Replies: 67
Views: 21002

Anyway, can this problem also be solved using Prim's algorithm?
Of course it can. I solved this problem using Prim's algorithm. :wink:


Anggakusuma
by angga888
Mon May 31, 2004 6:31 am
Forum: Volume 7 (700-799)
Topic: 767 - Game
Replies: 8
Views: 2456

There is a blue checkmark beside the problem title. The blue colour means multiple input. The first line of a multiple input file is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input...

Go to advanced search