## Search found 21 matches

Thu Jul 30, 2009 3:19 pm
Forum: Volume 106 (10600-10699)
Topic: 10648 - Chocolate Box
Replies: 15
Views: 7269

### Re: 10648 - Chocolate Box

@mf thanks a lot.. I was confused by the input outputs given earlier.
Thu Jul 30, 2009 10:24 am
Forum: Volume 106 (10600-10699)
Topic: 10648 - Chocolate Box
Replies: 15
Views: 7269

### Re: 10648 - Chocolate Box

I am using long double to store the probabilities of N chocolates being distributed in to M boxes with out leaving any of them empty. But I am getting precision problems ... for input N=100 and M=99 , my code outputs 1.0000000 which actually isn't the case.The logic seems to work as evident from out...
Tue Mar 10, 2009 3:31 pm
Forum: Volume 104 (10400-10499)
Topic: 10462 - Is There A Second Way Left?
Replies: 29
Views: 14429

### Re: 10462 - Is There A Second Way Left ?

This one was same as the problem 10600.My algo was the same for both and my solution for 10600 got accepted.
I followed the algo give in cormen to generate the second MST.
Please post some input cases that might be crucial in judging where my solution goes wrong.
Mon Mar 09, 2009 3:38 pm
Forum: Volume 104 (10400-10499)
Topic: 10462 - Is There A Second Way Left?
Replies: 29
Views: 14429

### Re: 10462 - Is There A Second Way Left ?

hey.. thanks for the help..my code is attached in my first post in the previous page.Please go through it .My algo also has been briefly explained there though I would like to explain in detail. I am using kruska's algorithm to find the MST.If the number of components after running kruskals is great...
Sat Feb 28, 2009 1:15 pm
Forum: Volume 104 (10400-10499)
Topic: 10462 - Is There A Second Way Left?
Replies: 29
Views: 14429

### Re: 10462 - Is There A Second Way Left ?

But my code gives the same answer as u have mentioned for the above input.. though the online judge gives a WA
Wed Feb 04, 2009 4:01 pm
Forum: Volume 104 (10400-10499)
Topic: 10462 - Is There A Second Way Left?
Replies: 29
Views: 14429

### Re: 10462 - Is There A Second Way Left ?

I am getting WA I tried to solve this problem by first finding a MST using kruskals and then finding the max[u,v] for all vertices u ,v in the MST and using this further to find the second MST. MY code gives right outputs for all the test cases given above in this topic.. Can some check my code and ...
Fri Oct 31, 2008 8:14 am
Forum: Volume 106 (10600-10699)
Topic: 10687 - Monitoring the Amazon
Replies: 4
Views: 4510

### Re: 10687 - Monitoring the Amazon

My code seems to do the same ... but I got TLE.. please help me.. My algorithm 1)sort the possible outgoing N-1 edges from each vertex based on their length,minx and min y(criteria put in the descending order of their imp) and accept the first 2 edges 2)Once the Graph is built,run a BFS on top of it...
Mon Apr 28, 2008 12:18 pm
Forum: Volume 114 (11400-11499)
Topic: 11408 - Count DePrimes
Replies: 12
Views: 5631

### Re: 11408 - Count DePrimes

TLE :( I computed primes using sieves and then used these to evaluate whether an number is Deprime or not and I checked and stored this Deprime condition for every number ,prior to taking input ,but it gives me TLE please help me out!! attached is my code #include<iostream> #include<cstdlib> #inclu...
Sat Apr 26, 2008 3:43 pm
Forum: Volume 114 (11400-11499)
Topic: 11424 - GCD - Extreme (I)
Replies: 25
Views: 6688

### Re: 11424 - GCD Extreme (I)

Hi,I tried to solve 11424/11426 in the same way as discussed in this section.I got accepted for 11424 but TLE for 11426.I am generating primes using sieves and then incorporating them to generate phi function.I am unable to make out where I am going wrong in11426.Please help me out.. #include<iostre...
Sun Oct 14, 2007 9:23 pm
Forum: Volume 5 (500-599)
Topic: 548 - Tree
Replies: 23
Views: 10796

I did exactly wht xenon said(not constructing a tree ,but using a similar one to do dfs ..) but I am still getting TLE!!... so can some one help me out....this is my code #include<iostream> #include<vector> #include<cstdlib> #include<cstdio> #include<cstring> using namespace std; void leastleave(vec...
Sun Oct 14, 2007 9:48 am
Forum: Volume 100 (10000-10099)
Topic: 10063 - Knuth's Permutation
Replies: 14
Views: 5971

### WA... somebody plz help me out!!

I dont know whts wrong with my code.... I followed exactly the same procedure as mentioned in the question.. can anyone please help me out... #include<iostream> #include<string> using namespace std; void genpermute(string a, string b,int index) { if(index==a.length()) { cout<<b<<'\n'; } else { strin...
Wed Jun 20, 2007 7:57 pm
Forum: Volume 103 (10300-10399)
Topic: 10347 - Medians
Replies: 32
Views: 13979

### thanks a lot its.. working now!!

thanks it working now..
Wed Jun 20, 2007 6:03 pm
Forum: Volume 103 (10300-10399)
Topic: 10347 - Medians
Replies: 32
Views: 13979

### WA... somebody plz help me out!!

this is my code.. but it gives me a wrong ans..
[code]
[/code]
Fri Jun 15, 2007 12:27 pm
Forum: Volume 108 (10800-10899)
Topic: 10844 - Bloques
Replies: 15
Views: 10834

### TLE!!

I used bell triangle to solve the problem and since it involves very large numbers I used strings and wrote a function for string addition . and I was precalculating the results for the first 900 numbers. I am sure that this precalculation is taking me more than 2 sec... so wht s the better way to d...
Thu Jun 07, 2007 2:56 pm
Forum: Volume 102 (10200-10299)
Topic: 10299 - Relatives
Replies: 57
Views: 13922

### a better algo...plz...

hi.. Though I got this problem accepted.. I am sure from the CPU time it took ,that the solution can be much better . first of all I am building a list of all primes less than sqrt(1000000000) using sieves.. then given a number N.. initialising sol=N I am iterating though the list to find which ever...