Search found 7 matches

by jonaskoelker
Fri Apr 08, 2005 12:54 am
Forum: Volume 1 (100-199)
Topic: 105 - The Skyline Problem
Replies: 160
Views: 51459

Hi.

I was thinking about this code fragment

if (w_ptr == &head)
{
if (head.next == &head)
insert_to_list(w_ptr, &in_node);
else
insert_to_list((w_ptr->back), &in_node);
break;
}


why not just:

if (w_ptr == &head)
insert_to_list(head -> back, &in_node)

since (&head == head.next ...
by jonaskoelker
Sun Feb 13, 2005 3:39 pm
Forum: Volume 1 (100-199)
Topic: 118 - Mutant Flatworld Explorers
Replies: 68
Views: 20532

Nope, no AC yet.

my new implementation (in C++) gets your suggested input right: "0 0 W LOST". If any one of you have gotten AC, could you do me the favor of running my test input through your solution? Thanks in advance.

just in case you want to see the new code, here is it:

# include <iostream ...
by jonaskoelker
Fri Feb 11, 2005 6:14 am
Forum: Volume 1 (100-199)
Topic: 118 - Mutant Flatworld Explorers
Replies: 68
Views: 20532

thanks...

To ImLazy: thanks for you reply. Unless I'm mistaken, your suggested logic is the same as mine, except that the first condition is doubly negated ('if not not ...'). Of course, I could very well be mistaken, in which case: could you point out which part of the code is wrong?

To everyone: it's ...
by jonaskoelker
Thu Feb 10, 2005 7:26 pm
Forum: Volume 1 (100-199)
Topic: 155 - All Squares
Replies: 11
Views: 3885

upper left. Says so in the problem.
by jonaskoelker
Sun Feb 06, 2005 4:14 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318270

time out.

try running this:
time echo "1 1000000" | java Main
that is, take time on how long it takes to solve the biggest problem instance possible. I think you'll be surprised.

To speed it up, you might want to save some of your previous results, so you don't run through a gazillion iterations for each ...
by jonaskoelker
Sun Feb 06, 2005 4:01 am
Forum: Volume 1 (100-199)
Topic: 118 - Mutant Flatworld Explorers
Replies: 68
Views: 20532

118 WA: wtf

I get WA for problem 118, which frustrates me quite a bit, since it sounds deceptively simple. I think I've read the problem carefully enough, but I might be wrong. The only 'trick' I see is the fall-over-the-edge logic, which I understand as:

next.point = getmove(current.point)
if (next.point is ...
by jonaskoelker
Sat Feb 05, 2005 12:08 am
Forum: Volume 1 (100-199)
Topic: 109 - SCUD Busters
Replies: 96
Views: 36960

It's possible to do this problem without floating-point calculations at all: using the given area formula, we can compute twice the area as an int, then output either '50' or '00' as the decimal part, based on whether the int is even or not.

Go to advanced search