Search found 46 matches

by mpi
Sat Jan 12, 2008 8:25 pm
Forum: Volume 113 (11300-11399)
Topic: 11386 - Triples
Replies: 23
Views: 8692

OK. Then, what's the output for the following input:

Code: Select all

7
3 3 3 5 5 8 8
My output

Code: Select all

12
by mpi
Sat Jan 12, 2008 7:17 pm
Forum: Volume 113 (11300-11399)
Topic: 11386 - Triples
Replies: 23
Views: 8692

Observer,

Are you saying that my approach is right? When I have to use 64-bit integers: output (of course) AND input?? unsigned, signed?
by mpi
Sat Jan 12, 2008 5:45 pm
Forum: Volume 113 (11300-11399)
Topic: 11386 - Triples
Replies: 23
Views: 8692

Something hidden in the statement?

My algorithm is very simple and yet i'm getting WA all the time. Here it goes: 1 - Sort the input in non-decreasing order into num 2 - nt = 0 3 - Iterate from i=3..n j = 0 k = i - 1 While (j < k) sum = num[j] + num[k] if (sum < num[i]) ++j // discard the element from the left end else if (sum > num[...
by mpi
Mon Sep 03, 2007 7:51 pm
Forum: Bugs and suggestions
Topic: 10195 - The Knights Of The Round Table
Replies: 0
Views: 1832

10195 - The Knights Of The Round Table

There is a mistake in the statement. In INPUT section, when it says: Each room is represented by three real numbers (a, b and c), which stand for the sizes of the triangular sunlighted area I think it should say: Each room is represented by three real numbers (a, b and c), which stand for the sides ...
by mpi
Wed Aug 01, 2007 9:16 pm
Forum: General
Topic: Problem hardness index
Replies: 7
Views: 5681

To my mind, the best solution must combine the two approaches discussed so far. That is, the final rating o "hardness index" of a problem should merge two complementary units of measurement: 1) Statistics . It's quite obvious that the percentage of people who have succesfully solved the problem is a...
by mpi
Fri Jul 20, 2007 5:09 pm
Forum: Volume 111 (11100-11199)
Topic: 11115 - Uncle Jack
Replies: 25
Views: 15939

Oh my god! :o
How easy it was! The point is that i was facing the problem focusing only on the number of people.

Thanks, mf, your explanation was very clear.
by mpi
Fri Jul 20, 2007 3:13 pm
Forum: Volume 111 (11100-11199)
Topic: 11115 - Uncle Jack
Replies: 25
Views: 15939

I can't understand the n^d approach neither. My approach is based on a recurrence formula that i think is more intuitive: for (k = 0..d) comb(n, d) = comb(n, d) + c(n, k) * comb(n-1, d-k) where c(n, k) stands for binomial coefficient: http://mathworld.wolfram.com/Combination.html By the way, anyone ...
by mpi
Wed Jul 11, 2007 7:24 pm
Forum: Volume 112 (11200-11299)
Topic: 11232 - Cylinder
Replies: 34
Views: 15543

Thanks a lot Adrian. It's difficult to see integers among so many floating point operations :D
by mpi
Wed Jul 11, 2007 6:58 pm
Forum: Volume 112 (11200-11299)
Topic: 11232 - Cylinder
Replies: 34
Views: 15543

Not so simple?

I think this problem is not so complicated, but i'm getting WA all the time. Here is the algo:

Code: Select all

  // removed after Acc
My program gives the right results to the inputs shown in this thread. Anyone can help?
by mpi
Wed Mar 28, 2007 3:10 pm
Forum: Volume 102 (10200-10299)
Topic: 10252 - Common Permutation
Replies: 150
Views: 52751

Oh my gO_od!

OK, i've just found the subtle mistake that was spoiling my code and hence my results, notice the difference:

Before:

Code: Select all

for (j = 0; j < min; j++) 
    permutacion[k++] = i;
After:

Code: Select all

for (j = 0; j < min; j++) 
    permutacion[k++] = (char)i;
Sometimes i feel a bit embarrassed :oops:
by mpi
Wed Mar 21, 2007 7:25 pm
Forum: Volume 102 (10200-10299)
Topic: 10252 - Common Permutation
Replies: 150
Views: 52751

this problem can't be that difficult

I've tried it hundreds of times but always get WA. I'm getting tired of this silly problem, it's too straightforward to worth doing it. My approach is based on counting the frequencies of characters in the two input strings, handling empty lines too. Here is my short code for this problem: #include ...
by mpi
Sat Nov 04, 2006 12:53 am
Forum: Volume 9 (900-999)
Topic: 967 - Circular
Replies: 23
Views: 12901

You are right. There are only 42 numbers. What i was thinking about? :oops:
Now i get AC in 0.674s.

Thanks
by mpi
Fri Nov 03, 2006 11:51 pm
Forum: Volume 9 (900-999)
Topic: 967 - Circular
Replies: 23
Views: 12901

i'm following the same approach than you and i always get TLE. After generating all circular primes between 100..1000000, i only have to do a simple iteration through my array and count the 1's. It's simple, but however i get TLE.
by mpi
Fri Nov 03, 2006 10:21 pm
Forum: Volume 2 (200-299)
Topic: 293 - Bits
Replies: 8
Views: 2591

PERFECT! That was the problem. Now i get AC with 0.053s. I think that case is a bit tricky though. When i first read your last post i thought you were wrong, but soon i realized my mistake. I've always thought that at least 1 bit is needed to store some data :) Thanks a lot! I really appreciate your...
by mpi
Fri Nov 03, 2006 9:01 pm
Forum: Volume 2 (200-299)
Topic: 293 - Bits
Replies: 8
Views: 2591

No problem with that kind of input. But thanks anyway!

Go to advanced search