Search found 16 matches

by drewsome
Sun May 21, 2006 9:48 pm
Forum: Volume 1 (100-199)
Topic: 128 - Software CRC
Replies: 62
Views: 7219

this is a horrible problem

Try using unsigned int instead of int. 34942 << 16 = overflow
by drewsome
Mon Aug 15, 2005 4:10 am
Forum: Volume 7 (700-799)
Topic: 775 - Hamiltonian Cycle
Replies: 11
Views: 3194

775 - Hamiltonian Cycle

Hi, I am trying to solve 775 using simple backtracking. I've also tried pruning using BFS to make sure there was still a path back to the start vertex at each step. I am getting TLE.. please help! ;) Thanks, - Andrew #include <iostream> #include <map> #include <stdio.h> #include <set> using namespac...
by drewsome
Wed Aug 10, 2005 6:33 pm
Forum: Volume 104 (10400-10499)
Topic: 10487 - Closest Sums
Replies: 89
Views: 29586

Yeah, I got AC :) Here is another testcase to help anyone who might have WA:

4
1
4
7
8
3
0
5
100000

Case 1:
Closest sum to 0 is 5.
Closest sum to 5 is 5.
Closest sum to 100000 is 15.

- Andrew
by drewsome
Wed Aug 10, 2005 10:01 am
Forum: Volume 104 (10400-10499)
Topic: 10487 - Closest Sums
Replies: 89
Views: 29586

10487 WA

Hrrrmmm. Why am I getting WA? I've read all the other posts for this problem.. nothing helps :(

Code: Select all

code removed after AC :)
Thanks! :)
- Andrew
by drewsome
Mon Aug 08, 2005 6:58 am
Forum: Volume 8 (800-899)
Topic: 824 - Coast Tracker
Replies: 8
Views: 6077

Jan, I don't think your sample input makes sense. For instance, your first test case looks like this: 110 011 110 with direction = 4. However, this is impossible - the direction must be 5 (giving a previous square of [0,2]). If the direction were indeed 4 then we would have a non-optimal previous sq...
by drewsome
Sat Jul 30, 2005 10:07 am
Forum: Volume 100 (10000-10099)
Topic: 10054 - The Necklace
Replies: 62
Views: 30887

Hi Deneb I had much troubles with this part, and that's what makes my code so ugly and so slow :oops: The algorithm is as follows : /* I don't mention global variables used to mark the cycles and to store the eulerian cycle */ /* direct_cycle is the direct cycle you're processing */ construct_euler...
by drewsome
Thu Jul 07, 2005 8:53 am
Forum: Volume 100 (10000-10099)
Topic: 10029 - Edit Step Ladders
Replies: 70
Views: 20485

10029 help! TLE

Hi, I've read the other posts on 10029, and from what I've read it seems to me my implementation should work. I think the culprit may be in my calcVariations() function, where I generate all possible edit steps for a string.. maybe STL string is too slow for this? In any case, I wrote my own linked ...
by drewsome
Fri Jul 01, 2005 11:14 am
Forum: Volume 105 (10500-10599)
Topic: 10553 - Treasure Map
Replies: 24
Views: 6755

Hi!

I'm also having trouble with this problem. I got the solution for the sample input no problem, and also managed to calculate 1.29 for this testcase: 2 NE 2 S 1 -90 I'm pretty sure the problem is something to do with the way I handle angles.. I probably put too much faith in c++ trigonometric functio...
by drewsome
Thu Jun 23, 2005 6:34 am
Forum: C++
Topic: Sorting arrays of pointers using <algorithm> sort()
Replies: 1
Views: 1532

Sorting arrays of pointers using <algorithm> sort()

Hi everyone! My question is pretty straightforward: I have an array of pointers that I would like to sort using the sort() function prvoided in <algorithm>. If it was an array of objects, I would do the following: #include <algorithm> struct s { const bool operator<(const s other) const { return tru...
by drewsome
Sun Apr 18, 2004 10:35 am
Forum: Volume 101 (10100-10199)
Topic: 10160 - Servicing Stations
Replies: 20
Views: 13165

Thank-you so much!!

I implemented all of your suggestions, and I got my solution accepted (runtime was 28.586 seconds).

I'm curious as to how I could make my program go faster. Is there some obvious heurestic that I missed?

-Andrew
by drewsome
Thu Apr 15, 2004 9:47 am
Forum: Volume 101 (10100-10199)
Topic: 10160 - Servicing Stations
Replies: 20
Views: 13165

Hi, Thank you for your reply. I appreciate it :) I still can't crack this problem. I've tried many different things so far. Basically my solution does what you described. In an attempt to make my code run faster, my latest "optimization" was to make it so that before I recurse, I sort the remaining ...
by drewsome
Tue Apr 13, 2004 8:23 am
Forum: Volume 101 (10100-10199)
Topic: 10160 - Servicing Stations
Replies: 20
Views: 13165

Yo, I'm also having trouble with this question (I keep getting Time Limit Exceeded). Have you managed to solve it by any chance? If so -- any hints? Thanks in advance.
by drewsome
Tue Dec 23, 2003 4:27 pm
Forum: Volume 102 (10200-10299)
Topic: 10247 - Complete Tree Labeling
Replies: 2
Views: 3331

10247 - Complete Tree Labeling

Hi, I've been working on 10247, but I keep getting alternations between WA and TLE from our dear pal the judge. My program seems to work for the sample inputs. I also ran some other inputs on the program, and here's what I got: 3 6: 1562426428985838116716663847602053919993687706682744920691775 87449...
by drewsome
Tue Dec 23, 2003 4:09 pm
Forum: Volume 102 (10200-10299)
Topic: 10254 - The Priest Mathematician
Replies: 10
Views: 5451

Hi, I get the right answer for n = 64 and n = 28, but when I type in n = 9876 I get: 6964824117983874234650500427748868209542865000190576981818345 9167875096365227972472038355305206881965379346125792003500964 48775287769802767937463111146298807126530166456649252977 Some other test values I tried: n ...
by drewsome
Mon Dec 08, 2003 12:06 am
Forum: Java
Topic: ArrayList
Replies: 4
Views: 2771

Yeah.. I really hope they upgrade their java support soon :)

It's horrible.. you can't even do basic sorting using the Arrays or Collections classes.

Argh.. maybe I'll have to bite the bullet and learn the C++ STL.

Go to advanced search