Search found 80 matches

by Quantris
Tue May 09, 2006 12:40 am
Forum: Volume 102 (10200-10299)
Topic: 10236 - The Fibonacci Primes
Replies: 28
Views: 11611

gah, this was tough because the precision is dependent on the compiler version.

tough cases include 9307 -- 495091651, 15086 -- 920759405, and 15520 -- 386616082.

At least, those are the three that I "special cased" :)
by Quantris
Sun May 07, 2006 12:51 am
Forum: Volume 1 (100-199)
Topic: 188 - Perfect Hash
Replies: 9
Views: 5250

wrong, the problem assures 32-bit integer (unsigned, of course) is sufficient.
by Quantris
Sat May 06, 2006 10:55 pm
Forum: Volume 1 (100-199)
Topic: 180 - Eeny Meeny
Replies: 34
Views: 10569

It gets WA ;)

Actually I agree with you and junbin, so the problem statement needs to be changed to better reflect what they want.
by Quantris
Sat May 06, 2006 6:33 am
Forum: Volume 1 (100-199)
Topic: 177 - Paper Folding
Replies: 28
Views: 7788

That's kind of mean.
by Quantris
Sat May 06, 2006 4:28 am
Forum: Volume 1 (100-199)
Topic: 173 - Network Wars
Replies: 29
Views: 2815

I just got AC in this problem, here's a description of my decision tree: 1. If both start in the same place, output "both annihilated" and that's all (not sure if this occurs in the data though) EDIT: it does. 2. Find the next position for paskill and lisper (when doing paskill, you assume he cannot...
by Quantris
Thu May 04, 2006 4:18 am
Forum: Bugs and suggestions
Topic: Problem 285: Faulty input
Replies: 1
Views: 1821

Problem 285: Faulty input

I strongly suspect that there is something wrong with the input for problem 285 (alternatively, the statement needs to be adjusted). Specifically, the statement says: "The direction is given by a single character where u means upwards, r means right, d means down and l means left. Given crossword wi...
by Quantris
Thu May 04, 2006 4:14 am
Forum: Volume 2 (200-299)
Topic: 285 - Crosswords
Replies: 16
Views: 9305

Never mind, I got AC. I wrote it again from scratch, and I guess I have better habits now -- it looks like some of the words don't use 'u', 'r', 'd', or 'l' to specify the direction, and I get AC when such entries are ignored completely (my WA prog would write the first letter into the grid at least...
by Quantris
Thu May 04, 2006 3:48 am
Forum: Volume 2 (200-299)
Topic: 285 - Crosswords
Replies: 16
Views: 9305

If you still have your program around, can you check if adding spaces to the start of the solution line changes "correct" to "incorrect" or not?

Thank you,
by Quantris
Thu May 04, 2006 3:24 am
Forum: Volume 2 (200-299)
Topic: 285 - Crosswords
Replies: 16
Views: 9305

Thanks for the info, but unfortunately mine matches up with that so far.

I'll keep trying :)
by Quantris
Wed May 03, 2006 10:23 pm
Forum: Volume 100 (10000-10099)
Topic: 10019 - Funny Encryption Method
Replies: 45
Views: 5790

Personally, I prefer redirecting files on the command line, such as:

./program < in.txt > out.txt

... which lets you test how the program handles various cases etc. easily, and also produces an output file for diff'ing with output from somewhere else (like the forum).
by Quantris
Wed May 03, 2006 6:40 pm
Forum: Volume 2 (200-299)
Topic: 285 - Crosswords
Replies: 16
Views: 9305

Anyone have any suggestions for this one?
by Quantris
Wed Apr 19, 2006 7:35 pm
Forum: Algorithms
Topic: stl dijkstra
Replies: 9
Views: 3550

yes, usually I use priority_queue with a seperate array (or vector) to track the current priority of each element (so that I don't add unnecessary duplicates or process redundant entries), which usually works.

Someday I'll implement a good fibonacci heap and just use that.
by Quantris
Wed Apr 19, 2006 7:27 pm
Forum: Algorithms
Topic: A regional contest problem
Replies: 6
Views: 2053

This problem can be done as a linear minimisation (so using the simplex algorithm). You do need to be careful about how you define the problem, since there is at least one wrong way (runs too slow) and one right way :) Any greedy approach that I came up with didn't work, so I'm not sure that it is t...
by Quantris
Sun Feb 26, 2006 10:09 pm
Forum: C++
Topic: need help for STL sort inside a class
Replies: 6
Views: 2715

A comment

I tend to prefer something like: struct sortBy { const vector<int> &key; sortBy(const vector<int> &S) : key(S) {} bool operator()(int a, int b) const { return key[a] < key[b]; } }; and then you can use sort(a.begin(), a.end(), sortBy(s)); This is just a bit more modular so you can apply it to vector...
by Quantris
Wed Jan 25, 2006 9:02 am
Forum: C++
Topic: Combinations and Permutations
Replies: 3
Views: 2367

I hope you realise that 500 choose 10 is enormous -- bigger than 10^20 -- no matter what method you use it's going to take a long time to enumerate (consider the printing time alone) them all. next_permutation is quite fast for enumerating permutations. You can gain a little speed by implementing th...

Go to advanced search