Search found 67 matches

by dumb dan
Wed Jul 12, 2006 3:06 pm
Forum: Volume 110 (11000-11099)
Topic: 11034 - Ferry Loading IV
Replies: 15
Views: 6708

The ferry is initially on the left bank where it broke and it took quite some time to fix it. In the meantime, lines of cars formed on both banks that await to cross the river. In other words, cars on left side never have to wait on cars on the right side and vice verca. Two seperate waiting lines....
by dumb dan
Sun Jun 04, 2006 10:13 am
Forum: Volume 2 (200-299)
Topic: 208 - Firetruck
Replies: 48
Views: 14896

If there is a thread about your problem, please use it.
This question has already been asked in this thread:
http://online-judge.uva.es/board/viewtopic.php?t=6581
by dumb dan
Sat Jun 03, 2006 10:02 am
Forum: Volume 100 (10000-10099)
Topic: 10038 - Jolly Jumpers
Replies: 445
Views: 77746

I think you need to read the input/output specifications of the problem more carefully. Your program needs to handle more than one case (more than one line of input). That is, you should not have to restart your program for every new case, it should keep reading input until there is no more input to...
by dumb dan
Thu Jun 01, 2006 6:22 pm
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20753

No problem.

You should probably remove your code now (it's custom to remove ones code after getting AC).
by dumb dan
Thu Jun 01, 2006 12:37 pm
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20753

Two things that might cause you problems:

char c,snum[5];
5 might be too low. Try changing it to 10 (you want to be able to read numbers that would fit into a 32-bit int).

Also, you print an extra blank line after the last case, which might cause a presentation error.
by dumb dan
Tue May 30, 2006 2:30 pm
Forum: Volume 3 (300-399)
Topic: 386 - Perfect Cubes
Replies: 53
Views: 6964

I don't know why you'd get WA, I would have expected you to get TLE though. You definately want to use ints instead of long ints.

Besides this, there are very simple means by which your solution can be made more efficient.
by dumb dan
Tue May 30, 2006 2:10 pm
Forum: Volume 1 (100-199)
Topic: 160 - Factors and Factorials
Replies: 205
Views: 24080

Try this input and see if you can spot your error (and don't forget to remove your code after you get AC).

input:

Code: Select all

45
47
49
0
by dumb dan
Mon May 29, 2006 6:28 pm
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 29760

C++ is smart enough to realize there's only one sensible way to combine a char and a string and that's to treat the char as a string of size 1 :)
Thus the two are equivalent, but I'm lazy so I prefer the shorter way of writing it.
by dumb dan
Mon May 29, 2006 6:17 pm
Forum: Volume 6 (600-699)
Topic: 623 - 500!
Replies: 187
Views: 43174

As for the basic idea of biginteger multiplication. There are of course several methods and it all depends on how efficient you want it to be and how big numbers you have as well as what you want to use it for. But as a basic idea, you should represent your numbers as arrays of words, where each wor...
by dumb dan
Mon May 29, 2006 5:35 pm
Forum: Volume 6 (600-699)
Topic: 623 - 500!
Replies: 187
Views: 43174

As time reference. I used the same bigint implementation for 10106 as I did for 623.

My program solved 10106 in 0.027 while it took 2.713 to solve problem 623.

With this reference it's perhaps not surprising that your implementation resulted in a TLE.
by dumb dan
Mon May 29, 2006 5:03 pm
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 29760

The judge is using an older version of g++ (version 2.95.3).
Your error is on the line:

if(res!=0) r=string(1,res+'0')+r;

You might try replacing it with

if(res!=0) r=(char)(res+'0')+r;
by dumb dan
Mon May 22, 2006 6:42 pm
Forum: Volume 107 (10700-10799)
Topic: 10769 - Pillars
Replies: 22
Views: 10834

At first glance your code looks fine to me. The only input I can come up with, which your program would fail on, is one that contains pieces of 0 height. Such as: 3 1 1 1 0 1 1 0 0 0 As I read the problem statement, the total height h is equal or greater to 1, but no such guarantee is made for the i...
by dumb dan
Fri Sep 23, 2005 12:45 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 60581

jjtse wrote:That's a good idea, but where are you going to find an array big enough to hold a bazillion prime numbers?
By sqrt(10000^2+10000+41), I mean the square root of (10000^2+10000+41). Which is 10001. And in the range from 2 to 10001 there are only 1229 prime numbers.
by dumb dan
Fri Jun 03, 2005 10:49 am
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 9432

I ran a full search on your outputs, and you fail to strip a leading zero from one of your bignums before you print it.

input:

Code: Select all

5 53
0 0
Otherwise all your outputs look ok.
by dumb dan
Mon May 30, 2005 10:42 am
Forum: Volume 101 (10100-10199)
Topic: 10139 - Factovisors
Replies: 80
Views: 26344

Re: 10139 Better Algorithm ?

CodeJerk wrote:

Code: Select all

do{
    ...
  } while (true);
I think it's the endless loop that gives you TLE.

Go to advanced search