11549 - CALCULATOR CONUNDRUM

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

Moderator: Board moderators

11549 - CALCULATOR CONUNDRUM

Postby Ron » Fri Nov 07, 2008 6:08 pm

Give me hints please..!!
Ron
Learning poster
 
Posts: 55
Joined: Mon Jul 23, 2007 5:01 pm
Location: INDIA

Re: 11549 - CALCULATOR CONUNDRUM

Postby pvncad » Fri Nov 07, 2008 7:37 pm

pvncad
New poster
 
Posts: 27
Joined: Sun Feb 18, 2007 2:14 pm

Re: 11549 - CALCULATOR CONUNDRUM

Postby Ron » Tue Nov 11, 2008 10:59 pm

I am getting TLE using Cycle detection algorithm...

Code: Select all
got AC
Last edited by Ron on Wed Nov 12, 2008 3:55 pm, edited 1 time in total.
Ron
Learning poster
 
Posts: 55
Joined: Mon Jul 23, 2007 5:01 pm
Location: INDIA

Re: 11549 - CALCULATOR CONUNDRUM

Postby Abednego » Tue Nov 11, 2008 11:03 pm

pvncad wrote:use cycle detection algorithm

Or you could just remember all of the numbers you've seen so far and stop as soon as you reach a previously seen number. That's what I did.
Let's hope Yury doesn't notice that I'm solving problems again.
User avatar
Abednego
A great helper
 
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA

Re: 11549 - CALCULATOR CONUNDRUM

Postby Ron » Wed Nov 12, 2008 6:18 am

Abednego wrote :
Or you could just remember all of the numbers you've seen so far and stop as soon as you reach a previously seen number. That's what I did.

How did you store previous numbers after find new number by given function ??
Last edited by Ron on Wed Nov 12, 2008 6:20 am, edited 1 time in total.
Ron
Learning poster
 
Posts: 55
Joined: Mon Jul 23, 2007 5:01 pm
Location: INDIA

Re: 11549 - CALCULATOR CONUNDRUM

Postby Abednego » Wed Nov 12, 2008 6:29 am

Code: Select all
set<int> seen;

You could also set up a huge bit vector to make updates O(1), as long as you only use one bit per number, but it wasn't necessary.
Let's hope Yury doesn't notice that I'm solving problems again.
User avatar
Abednego
A great helper
 
Posts: 281
Joined: Tue Sep 10, 2002 5:14 am
Location: Mountain View, CA, USA

Re: 11549 - CALCULATOR CONUNDRUM

Postby Ron » Wed Nov 12, 2008 7:51 am

Still, i am getting TLE :(

Code: Select all
finally .. AC


The problem was in my function in which i was taking so much time to find next number.
Ron
Learning poster
 
Posts: 55
Joined: Mon Jul 23, 2007 5:01 pm
Location: INDIA

Re: 11549 - CALCULATOR CONUNDRUM

Postby calicratis19 » Fri Apr 24, 2009 8:03 am

i have got AC in this prob. but it took huge time 4.150 sec.

can any one pls explain the floyd's cycle finding algo pls 8) 8) ?? i have read abt it in wiki but couldnt understand :cry: :cry: :cry: .
Heal The World
calicratis19
Learning poster
 
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Location: SUST,SYLHET,BANGLADESH.

Re: 11549 - CALCULATOR CONUNDRUM

Postby Jehad Uddin » Fri Jul 31, 2009 3:47 pm

u can use map,to find the no that was found before,
u can declare map lyk this,
#include<map>
......
map<int,int>map_name;
.....
Jehad Uddin
Learning poster
 
Posts: 74
Joined: Fri May 08, 2009 5:16 pm

11549 - CALCULATOR CONUNDRUM

Postby lionking » Fri Aug 07, 2009 7:22 pm

could someone give me some IO to test?

I got WA...
lionking
New poster
 
Posts: 9
Joined: Tue Feb 17, 2009 6:46 pm

Re: 11549 - CALCULATOR CONUNDRUM

Postby saiful_sust » Mon Aug 10, 2009 8:07 pm

Hi try this case:


input:
Code: Select all
3
45 3
3 45
5 12


output:
Code: Select all
9
992
99162
saiful_sust
Learning poster
 
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET


Return to Volume CXV

Who is online

Users browsing this forum: No registered users and 0 guests

cron