Search found 1332 matches

by Jan
Mon Feb 16, 2009 12:50 pm
Forum: Volume 113 (11300-11399)
Topic: 11385 - Da Vinci Code
Replies: 70
Views: 24598

Re: 11385 - Da Vinci Code

char os[110]; Check this line. After declaring it, since you haven't initialized it, so, garbage values will be there. Now, you are assigning some uppercase characters in the array and assuming that the rest don't contain any uppercase character. But since garbage values are there, there can be upp...
by Jan
Mon Feb 16, 2009 12:35 pm
Forum: Volume 115 (11500-11599)
Topic: 11572 - Unique Snowflakes
Replies: 36
Views: 13227

Re: 11572 - Unique Snowflakes

Code: Select all

bool * a = new bool[1000000001];
1) You are declaring a huge memory locally.
2) 1000000000 byte = 954 MB (almost), the memory limit is 32 MB.

You can use a map instead of the array. Now it takes O(1) to access, but in a map it will take O(log(n)), but still its feasible. Hope these help.
by Jan
Sun Feb 15, 2009 6:09 pm
Forum: Volume 115 (11500-11599)
Topic: 11573 - Ocean Currents
Replies: 12
Views: 3978

Re: 11573 - Ocean Currents

I think you can avoid heap easily. I avoided stl, and got accepted in .7 seconds.
by Jan
Sun Jan 11, 2009 8:11 pm
Forum: Volume 115 (11500-11599)
Topic: 11561 - Getting Gold
Replies: 31
Views: 10214

Re: 11561 - Getting Gold

Try the case.

Input:

Code: Select all

6 5
######
#TG..#
#TG.G#
#TGPG#
######
Output:

Code: Select all

5
by Jan
Thu Jan 08, 2009 11:27 pm
Forum: Bugs and suggestions
Topic: Data set for 931 - The Probable n-Ascendants
Replies: 1
Views: 1600

Data set for 931 - The Probable n-Ascendants

Dear Carlos,
I have mailed the data set in problemset@acm.uva.es. And the html is attached, too. So, you can upload the updated description. :)
by Jan
Thu Jan 08, 2009 10:52 pm
Forum: Bugs and suggestions
Topic: Volume 9: How to detect?
Replies: 0
Views: 1126

Volume 9: How to detect?

Dear admins, volume 9 contains some problems that don't have any data set. In the old system there was a tick mark to show that the data is available. But now, there is no identification. So, how to know that a problem has a data set. Is there any better idea (not by submitting fake code)?
by Jan
Wed Jan 07, 2009 2:42 pm
Forum: Volume 114 (11400-11499)
Topic: 11482 - Building a Triangular Museum
Replies: 9
Views: 3334

Re: 11482 - Building a Triangular Museum

Input:

Code: Select all

2 1
0 0
Output:

Code: Select all

Triangular Museum 1
B/\
/__\

Here B stands for a blank. But your code prints

Code: Select all

Triangular Museum 1
B/\B
/__\

An extra space in the first line. Hope it helps.
by Jan
Tue Jan 06, 2009 3:53 pm
Forum: Volume 114 (11400-11499)
Topic: 11401 - Triangle Counting
Replies: 19
Views: 10758

Re: 11401 - Triangle Counting

Check the following line...

Code: Select all

f = i*(i-1)-(i+1)*(i-b)-b*(b-1);
Since i, b both are normal integers so, overflow will occur if i/b is too big. So, declare i and b as 64 bit integer.
by Jan
Tue Jan 06, 2009 3:45 pm
Forum: Volume 114 (11400-11499)
Topic: 11428 - Cubes
Replies: 64
Views: 18122

Re: 11428 - Cubes

Read the description please. 'If there is more than one solution then output the one with smallest value of y.'
I think you are maximizing y.
by Jan
Fri Jan 02, 2009 2:58 pm
Forum: Volume 115 (11500-11599)
Topic: 11563 - Introspective Caching
Replies: 7
Views: 1517

Re: 11563 - Introspective Caching

Try the cases.

Input
Output
by Jan
Tue Dec 30, 2008 12:45 pm
Forum: Volume 115 (11500-11599)
Topic: 11545 - Avoiding Jungle in the Dark
Replies: 13
Views: 4793

Re: 11545 - Avoiding Jungle in the Dark

Try the cases.

Input:

Code: Select all

2
S**..*.**.......D
S*.*.*.*.*......D
Output:

Code: Select all

Case #1: 16
Case #2: 16
Hope these help.
by Jan
Tue Dec 30, 2008 12:33 pm
Forum: Volume 115 (11500-11599)
Topic: 11561 - Getting Gold
Replies: 31
Views: 10214

Re: 11561 - Getting Gold

Try the cases.

Input:

Code: Select all

8 4
########
#.T.TGT#
#.G..P.#
########
7 8
#######
#P...T#
#...G.#
#G.T..#
#.....#
#G..T.#
#.....#
#######
Output:

Code: Select all

1
2
Hope these help.
by Jan
Tue Dec 30, 2008 12:17 pm
Forum: Volume 115 (11500-11599)
Topic: 11571 - Simple Equations - Extreme!!
Replies: 31
Views: 11587

Re: 11571 - Simple Equations - Extreme!!

Thanks Robert Gerbicz and, tryit1. Got accepted. Just handled the overflow carefully :).
by Jan
Tue Dec 30, 2008 1:31 am
Forum: Volume 115 (11500-11599)
Topic: 11571 - Simple Equations - Extreme!!
Replies: 31
Views: 11587

Re: 11571 - Simple Equations - Extreme!!

Yeah, I have got accepted for the easy version. Here is my code...

Code: Select all

Accepted..
I cant find any overflow. If you find anything, please let me know. Thanks in advance.
by Jan
Mon Dec 29, 2008 8:58 pm
Forum: Volume 115 (11500-11599)
Topic: 11571 - Simple Equations - Extreme!!
Replies: 31
Views: 11587

Re: 11571 Simple Equations - Extreme!!

Hint 1: xyz = B. So, if |x| is smaller than |y| and |z|, then |x^3| <= B.
Hint 2: x is a divisor of B.

Btw I haven't got accepted yet. Getting WA. So far, I haven't found any bug. I am not using any floating point arithmetic. For finding square/cubic root I am using binary search.

Go to advanced search