Search found 7 matches

by Anunnaki
Sun Jan 04, 2009 2:32 am
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 56652

Re: Wrong Answer for 102

Can someone explain to me why "CBG" is alphabetically superior to "BGC"?

Edit: Never mind, I was doing it wrong.
by Anunnaki
Sat Dec 27, 2008 10:50 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 197573

Re: 100

mf wrote:For the input "1 1", the output should be "1 1 1".
BAH! I forgot to change "n = 1" to "a = 1" when I changed the return from n to a. I knew it was something small. Thank you! :D
by Anunnaki
Sat Dec 27, 2008 10:19 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 197573

Re: 100

Doing one case at a time is a good thing. Testing goes like this - your program is given on its standard input (via file redirection) a file with input data, it has to run and produce a file with output data on standard output. That file is then compared with output from a reference solution. You s...
by Anunnaki
Sat Dec 27, 2008 1:55 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 197573

Re: 100

Looks like for n=113383, the integers generated in 3n+1 sequence will overflow 32-bit integers, and this somehow leads into an infinite periodic loop. The problem statement says "no operation overflows a 32-bit integer", so you can assume that in judge's input there will be no test cases triggering...
by Anunnaki
Sat Dec 27, 2008 12:36 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 197573

Re: 100

Is there a way to do it, other than going through each individual number until j? Actually that's good enough to get accepted. The problem with your code is that it does a lot of unnecessary work on lines 41-45 at each iteration, which severely affects its runtime - makes it quadratic instead of li...
by Anunnaki
Fri Dec 26, 2008 10:22 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 197573

Re: 100

Try giving your program an input with i=1, j=1000000 - it'll take many hours to complete, which is too much. Time limit is only 3 seconds. Is there a way to do it, other than going through each individual number until j? There must be, because if not, then I can't see how you could do it in less th...
by Anunnaki
Thu Dec 25, 2008 11:17 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 197573

Re: 100

I keep getting TL, and I don't understand why. Can someone look at my code and tell me if they see something? #include <iostream> #include <string> #include <sstream> #include <vector> using namespace std; int nCalc (int i, int j) { int n, a = 0; vector<int> x; do { int di = i; for (n = 0; di != 1; ...

Go to advanced search