Search found 99 matches

by Solaris
Thu Feb 03, 2011 2:17 pm
Forum: Volume 100 (10000-10099)
Topic: 10090 - Marbles
Replies: 43
Views: 27397

Re: 10090 - Marbles

Try these

Input:

Code: Select all

1791
2000000000 13
1 21
1791
1 21
10 13
1791
10 21
1 13
1791
1 13
10 21
1791
10 13
1 21
1
10 3
1 2
1
1 2
10 3
0
Output:

Code: Select all

15 76
76 15
11 120
120 11
15 76
failed
failed
by Solaris
Thu Feb 03, 2011 1:11 am
Forum: Volume 102 (10200-10299)
Topic: 10290 - {Sum+=i++} to Reach N
Replies: 27
Views: 14569

Re: 10290 - {sum+=i++} to Reach N

I used sieve for generating primes upto sqrt(9e14) (only this takes around 0.9 secs)
Then I calculate number of odd divisors for each given number.
The total time it took was more than 2 secs. I see a lot of people got it AC in < 0.5 secs. Is there any better way of solving this?
by Solaris
Thu Mar 01, 2007 1:09 pm
Forum: Volume 100 (10000-10099)
Topic: 10058 - Jimmi's Riddles
Replies: 22
Views: 8414

It is easier to think of critical test cases if you give us overview of your approach. It is a typical Grammar Problem. All other approaches may result in Wrong Answers.
by Solaris
Mon Nov 06, 2006 8:27 pm
Forum: Volume 102 (10200-10299)
Topic: 10294 - Arif in Dhaka (First Love Part 2)
Replies: 10
Views: 6837

I have solved the problem using the Formula provided in http://mathworld.wolfram.com
I wanted to know whether there is any recurrance or DP solution for this problem ...
by Solaris
Mon Nov 06, 2006 8:22 pm
Forum: Volume 4 (400-499)
Topic: 458 - The Decoder
Replies: 71
Views: 25015

There is no breaking condition in your "while" loop ... :P
try some thing like

Code: Select all

while(gets(str))
{
   ......
   ......
}
while(1) defines an infinite loop ... while(gets(str)) will break when it reaches End of Input File
by Solaris
Thu Nov 02, 2006 8:40 am
Forum: Volume 100 (10000-10099)
Topic: 10058 - Jimmi's Riddles
Replies: 22
Views: 8414

- the extra words that seem to be in the input (I chose to regard them as wrong rather than ignore them) - the apostroph in the output (I just copied it from the example output, even though it seems to have ascii value > 127) - the "VERBs" in the definition of VERB (I chose to consider a ...
by Solaris
Mon Oct 30, 2006 8:45 pm
Forum: Volume 100 (10000-10099)
Topic: 10000 - Longest Paths
Replies: 160
Views: 51259

Your program does not pass the following case: 5 1 1 2 2 3 3 4 1 3 4 5 0 0 About your input I dont think there is any such input in the judge data .. though the logical ans should be (0,5) but my AC code does not pass that as well .. And I agree with Jan .. making new threads for each new problems o...
by Solaris
Mon Oct 30, 2006 9:30 am
Forum: Volume 104 (10400-10499)
Topic: 10466 - How Far?
Replies: 25
Views: 11122

Hello shamim,

Can u plz post some test cases for which the cosine rule may not work ?? I am stuck ... My code seems to work for all the cases that I can think of :(

thnx in advance :)
by Solaris
Thu Jun 15, 2006 11:54 pm
Forum: Volume 110 (11000-11099)
Topic: 11031 - Looking for a Subset
Replies: 24
Views: 20528

Hi bijon, first of all thanx to you as I used your I/O to get AC :D

just a hint .. there can be negative values as input ... (at least that was the reason for which I was suffering)
by Solaris
Wed Jun 14, 2006 4:25 pm
Forum: Volume 110 (11000-11099)
Topic: 11028 - Sum of Product
Replies: 24
Views: 14486

Hi .. I have wasted a whole today thinking about a traditional solution to this problem ... is GOOGLE the only solution to this problem ??? If anyone has solved it with some other way plz can u share your algo ?? And I completely agree with Darko .. GOOGLE is an english verb now (at least for us :wi...
by Solaris
Sun Jun 11, 2006 9:30 pm
Forum: Volume 110 (11000-11099)
Topic: 11036 - Eventually Periodic Sequence
Replies: 22
Views: 8164

Hi, Thanks to mf for mentioning the Floyd's Algorithm. It was really a nice algo and I have just got AC .. but the timing came really bad (about 4 sec). I had a few questions: 1. Well .. according to wiki .. I made two iterations and calculated the GCD to get the actual period. Is there any better w...
by Solaris
Tue Jun 06, 2006 5:53 pm
Forum: Volume 110 (11000-11099)
Topic: 11045 - My T-shirt suits me
Replies: 18
Views: 12428

rammestain wrote:I tried to solve this problem with dynamic programming but got TLE
I have solved the problem using memoization.

visited[a][c][d][e][f] becomes true when I have tried giving 'a' no of XS, 'b' no of S .... 'f' no of XXL t-shirts
by Solaris
Tue Jun 06, 2006 5:40 pm
Forum: Volume 110 (11000-11099)
Topic: 11042 - Complex, difficult and complicated
Replies: 20
Views: 16217

When you convert the number to polar form ... then

SPOILER
(a+ib)^n
= r^n (cos (n.t) + i sin (n.t) )

You can safely say that if r^n is greater than 2^30 then TOO COMPLICATED
by Solaris
Sat Mar 25, 2006 8:16 pm
Forum: Volume 100 (10000-10099)
Topic: 10039 - Railroads
Replies: 20
Views: 11614

Hi all, I have been gettin TLE in this problem for quite a long time now. My solution is as follows: 1. I have created a graph with Cities as Vertices and Train Routes as edges. 2. I maintain an array bestDepTime[][] bestDepTime [j] contains "If city(i) can be reached in time(j) then the best i...
by Solaris
Fri Mar 24, 2006 5:28 pm
Forum: Volume 110 (11000-11099)
Topic: 11003 - Boxes
Replies: 29
Views: 20138

The first line of each set of input is an integer N (1 ≤ N ≤ 1000). This is followed by N lines, each with two integers, both ≤ 3000, representing the weight and maximum load of each box respectively. Input ends with a case where N = 0. There can be multiple input sets. I am not sure whether your c...

Go to advanced search