Colombian Collegiate Programming League 2012 Problems

General topic about Valladolid Online Judge

Moderator: Board moderators

Post Reply
AhmadKhatar
New poster
Posts: 28
Joined: Fri Mar 30, 2012 12:57 am

Colombian Collegiate Programming League 2012 Problems

Post by AhmadKhatar » Wed Jun 06, 2012 3:35 am

Hi!
Does anybody know the algorithms used in the contest mentioned above?
I mean problems 12461 through 12470. I only need the names of the algorithms.
Thanks in advance!
:D

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: Colombian Collegiate Programming League 2012 Problems

Post by brianfry713 » Wed Jun 06, 2012 11:19 pm

12461 - Airplane - Probability theory.
12462 - Rectangle - I haven't solved it yet.
12463 - Little Nephew - Simple math.
12464 - Professor Lazy, Ph.D. - Simulation, GCD, rational numbers.
12465 - The Turanga Leela Problem - I haven't solved it yet.
12466 - Ancestors - I haven't solved it yet but you could call it graph theory.
12467 - Secret Word - String processing.
12468 - Zapping - Simple math, absolute value.
12469 - Stones - DP.
12470 - Tribonacci - I haven't solved it yet but you could try the matrix-power method.
Check input and AC output for thousands of problems on uDebug!

nupt-xxp
New poster
Posts: 4
Joined: Wed Jun 06, 2012 8:27 pm

Re: Colombian Collegiate Programming League 2012 Problems

Post by nupt-xxp » Thu Jun 07, 2012 8:36 am

yes, as brianfry713 says,i just plus that the 12467 can be solved by KMP.
and i don't know how to solve 12470,Could somebody tell me how to solve it?
maybe it's matrics , but i don't know its details,Could someone explain it to me ?
Please..
sorry for my bad english

stubbscroll
Experienced poster
Posts: 151
Joined: Tue Nov 16, 2004 7:23 pm
Location: Norway
Contact:

Re: Colombian Collegiate Programming League 2012 Problems

Post by stubbscroll » Thu Jun 07, 2012 2:21 pm

12465 - Number theory (number of divisors)
12466 - Topological sort, DP
12469 - Combinatorial game theory (win/loss-minimax with memoization)
12470 - Convert recurrence into matrix, fast matrix exponentiation

I think it's better to ask questions about individual problems in their own threads in order to keep this forum more tidy.

AhmadKhatar
New poster
Posts: 28
Joined: Fri Mar 30, 2012 12:57 am

Re: Colombian Collegiate Programming League 2012 Problems

Post by AhmadKhatar » Thu Jun 07, 2012 2:42 pm

nupt-xxp wrote:yes, as brianfry713 says,i just plus that the 12467 can be solved by KMP.
and i don't know how to solve 12470,Could somebody tell me how to solve it?
maybe it's matrics , but i don't know its details,Could someone explain it to me ?
Please..
sorry for my bad english
Hi and thanks for your help!
I solved it using the recurrence attached at the bottom.
Then you can use fast exponentiation to find the answer. For example to find matrix F to the power of n (i.e. F(n)):
if ( n is 0 ){
return unit-matrix(i.e. I);
}
else if ( n is even ){
return F(n/2)*F(n/2);
}
else{
return F(n-1)*F(1);
}
Remember that at each step of the recursion you should use modulus. Otherwise the result will be an overflow.
Attachments
Eq.JPG
Eq.JPG (12.55 KiB) Viewed 8493 times

nupt-xxp
New poster
Posts: 4
Joined: Wed Jun 06, 2012 8:27 pm

Re: Colombian Collegiate Programming League 2012 Problems

Post by nupt-xxp » Fri Jun 08, 2012 8:53 am

AhmadKhatar wrote:
nupt-xxp wrote:yes, as brianfry713 says,i just plus that the 12467 can be solved by KMP.
and i don't know how to solve 12470,Could somebody tell me how to solve it?
maybe it's matrics , but i don't know its details,Could someone explain it to me ?
Please..
sorry for my bad english
Hi and thanks for your help!
I solved it using the recurrence attached at the bottom.
Then you can use fast exponentiation to find the answer. For example to find matrix F to the power of n (i.e. F(n)):
if ( n is 0 ){
return unit-matrix(i.e. I);
}
else if ( n is even ){
return F(n/2)*F(n/2);
}
else{
return F(n-1)*F(1);
}
Remember that at each step of the recursion you should use modulus. Otherwise the result will be an overflow.
Thanks , i solved it! And the picture you shows is wonderful !
Also i found another wonderful picture!
Attachments
1339053958563_a041658666f48ccb0df4d242.jpg
1339053958563_a041658666f48ccb0df4d242.jpg (8.16 KiB) Viewed 8462 times
1339053958547_fb515764a20fdb2deaf8f87b.jpg
1339053958547_fb515764a20fdb2deaf8f87b.jpg (16.83 KiB) Viewed 8462 times

nupt-xxp
New poster
Posts: 4
Joined: Wed Jun 06, 2012 8:27 pm

Re: Colombian Collegiate Programming League 2012 Problems

Post by nupt-xxp » Sat Jun 09, 2012 5:27 pm

brianfry713 wrote:12461 - Airplane - Probability theory.
12462 - Rectangle - I haven't solved it yet.
12463 - Little Nephew - Simple math.
12464 - Professor Lazy, Ph.D. - Simulation, GCD, rational numbers.
12465 - The Turanga Leela Problem - I haven't solved it yet.
12466 - Ancestors - I haven't solved it yet but you could call it graph theory.
12467 - Secret Word - String processing.
12468 - Zapping - Simple math, absolute value.
12469 - Stones - DP.
12470 - Tribonacci - I haven't solved it yet but you could try the matrix-power method.
Now i'm thinking 12464,but i've no idea to solve it even you give the hints above.
a,b,n is so large and how to express a rational number ....
i'm puzzled and could someone tell me ?

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: Colombian Collegiate Programming League 2012 Problems

Post by brianfry713 » Tue Jun 12, 2012 12:32 am

On 12464 Try to solve the sample input with small n first. Code the rationals with two variables, one for the numerator and one for the denominator.
Check input and AC output for thousands of problems on uDebug!

nupt-xxp
New poster
Posts: 4
Joined: Wed Jun 06, 2012 8:27 pm

Re: Colombian Collegiate Programming League 2012 Problems

Post by nupt-xxp » Wed Jun 13, 2012 7:59 pm

brianfry713 wrote:On 12464 Try to solve the sample input with small n first. Code the rationals with two variables, one for the numerator and one for the denominator.
think you !i solved it!

Post Reply

Return to “General”