440 - Eeny Meeny Moo

All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 440 TLE?

Post by Obaida »

I have seen the ranking is 0.000 for this program. But my one is very slow :( !!!
I made a normal simulation to calculate the value. Is there any trick to find the value.
I hate such slow codes. :x
try_try_try_try_&&&_try@try.com
This may be the address of success.
mostafa_angel
New poster
Posts: 23
Joined: Sun Oct 04, 2009 12:03 pm

440 - Eeny Meeny Moo

Post by mostafa_angel »

I read question but I can not realize test cases with the difinition...
we must find the m that the Ulm city selected as the last city. but in the second test case for n = 4 the answer is m = 5
so the sequence is = {1 ,2 , 3 , 4 , 5}
Ulm is not the last one !!!!!
plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 440 TLE?

Post by plamplam »

This is how you can get this code done in very short time. When I submitted this code for the first time, I got AC :D, but the runtime was 0.904 seconds. Then I realized that 3<=n<=150, and an idea suddenly struck my head. I removed scanf("%d",&n);
and the for loop was replaced with for(n = 3; n < 150; n++) from my original code. After I calculated the result, I simply printed printf("if(n == %d) printf("%d\n");", n, result); and copied the printed lines from the terminal and pasted them. I got AC in 0.08 seconds :D. It is impossible to get 0.000 runtime nowadays, it sucks lol.
Note you need to add an escape character before " and \n in order to print them. And try to find an optimized solution before you do this. But we all know that everything is fair in war and programming :wink:
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson
renatov
New poster
Posts: 20
Joined: Fri Sep 21, 2012 6:33 am

Re: 440 - Eeny Meeny Moo

Post by renatov »

For example, N = 10, M = 3, considering "1" as the first selected city:

Code: Select all

1	2	3	4	5	6	7	8	9	10
2	3	4	5	6	7	8	9	10	
2	3	5	6	7	8	9	10		
2	3	5	6	8	9	10			
2	3	5	6	8	9				
2	3	6	8	9					
2	3	6	8						
2	3	8							
2	8								
2
Post Reply

Return to “Volume 4 (400-499)”