Search found 202 matches

by baodog
Tue Sep 16, 2008 4:22 am
Forum: Volume 114 (11400-11499)
Topic: 11490 - Just Another Problem
Replies: 4
Views: 2613

Re: 11490 - Just Another Problem

Hi Robert,

How did you solve it in 10ms :-). Is it possible to construct the solutions
directly without searching? Thanks!
by baodog
Thu Aug 07, 2008 10:23 am
Forum: Volume 114 (11400-11499)
Topic: 11462 - Age Sort
Replies: 49
Views: 18101

Re: 11462 - Ages Sort

Hi Robert!,

yes, I got 80ms using fread/fwrite, but I had to guess the size of input file.
Do you have a way of finding the size of input file without knowing file name?
Is there a function to get it from the handle (0) ?
by baodog
Tue Aug 05, 2008 4:55 am
Forum: Volume 114 (11400-11499)
Topic: 11476 - Factorizing Large Integers
Replies: 17
Views: 8181

Re: 11476

You can try your Code on the following similar factoring large integer problems on SPOJ, and see if your
runtime is also too small.

https://www.spoj.pl/problems/DIVSUM2/

If you want to check simple accuracy try:

https://www.spoj.pl/problems/DIVSUM
by baodog
Mon Aug 04, 2008 10:03 am
Forum: Volume 114 (11400-11499)
Topic: 11475 - Extend to Palindrome
Replies: 32
Views: 13799

Re: 11475 - Extend to Palindromes

Hi,

I use base N representation mod M, reading forward and backward, starting from
the last symbol. I keep get WA. I have tried many cases.
Help is appreciated! Thanks.

Code: Select all

Accepted... silly index error.  Thanks!
by baodog
Mon Jul 14, 2008 7:24 am
Forum: Volume 114 (11400-11499)
Topic: 11467 - Pythagorean Triangles
Replies: 3
Views: 1001

Re: 11467 - Pythagorean Triangles

Ahh, I found O(n^2logn) or Or O(n^3logn) for all 2000 cases.
Just shoot rays from single point.
by baodog
Mon Jul 14, 2008 5:06 am
Forum: Volume 114 (11400-11499)
Topic: 11467 - Pythagorean Triangles
Replies: 3
Views: 1001

11467 - Pythagorean Triangles

Hi,

I can only come up with O(n^4) algo for generating answers from 1...2000, but is too slow.
How is O(n^3) possible? Some hint is appreciated. Thanks!
by baodog
Thu Jun 26, 2008 8:24 pm
Forum: Volume 114 (11400-11499)
Topic: 11459 - Snakes and Ladders
Replies: 33
Views: 14680

Re: 11459 - Snakes and Ladders

2 3 5 4 4 5 6 7 5 6 7 5000000000000000000000000000000000000000000000000000000000000000000000 5000000000000000000000000000000000000000000000000000000000000000000000 3000 3 4 5 9 3 1 3 4 20 3 4 5 Should give the following based on the problem description, because you only move to 100 after throwing t...
by baodog
Thu Jun 26, 2008 11:55 am
Forum: Volume 114 (11400-11499)
Topic: 11459 - Snakes and Ladders
Replies: 33
Views: 14680

Re: 11459 - Snakes and Ladders

Your algo is not right. Notice it says No square contains more than one endpoint of ***any*** (any one) snake or ladder --- that means diffrent snakes can share end points. ... maybe that's why so few acs. I checked the dataset and found that many squares have both end point and starting point. Also...
by baodog
Wed Jun 25, 2008 6:03 am
Forum: Volume 114 (11400-11499)
Topic: 11457 - Classified
Replies: 4
Views: 1102

Re: 11457 - Classified

THanks. Do you have a reference? Can you describe your algorithm? Thanks!
by baodog
Wed Jun 25, 2008 1:01 am
Forum: Volume 114 (11400-11499)
Topic: 11457 - Classified
Replies: 4
Views: 1102

Re: 11457 - Classified

maybe construct one RMQ, keep list of indices for each node, and find the closest two nodes by binary search.
by baodog
Tue Jun 24, 2008 10:29 pm
Forum: Volume 114 (11400-11499)
Topic: 11457 - Classified
Replies: 4
Views: 1102

11457 - Classified

I tried constructing RMQ from DFS tree of each node with no parents.
However this TLEs, since there can be O(n) such RMQs.
Is there some way to do it with one RMQ, so each query is O(logn)?
How did you guys solve this one :-) ? Thanks!
by baodog
Sun Jun 22, 2008 6:46 am
Forum: Volume 114 (11400-11499)
Topic: 11456 - Trainsorting
Replies: 20
Views: 10434

Re: 11456 - Trainsort

Nevermind.
by baodog
Fri Jun 06, 2008 7:46 am
Forum: Volume 114 (11400-11499)
Topic: 11454 - Very well informed domino player
Replies: 9
Views: 3220

Re: 11454 - Very well informed domino player

So what's wrong with my code? Thanks! Since all pieces are different, once you put down
(a b) if a!=b, then it will be unique. If a==b to start with, you have to divide
the total by 1/2. I simply use brute force to enumerate.
by baodog
Sun May 25, 2008 11:42 pm
Forum: Volume 114 (11400-11499)
Topic: 11454 - Very well informed domino player
Replies: 9
Views: 3220

Re: 11454 - Very well informed domino player

Hi, For some reason, I can not get the same answer as you and LayCurse. Do you care to share your WA code, so we can compare and see if there are different interpretations of the problem? btw, I assume you cannot pass if you have a piece that you can play, and after no one can play the game ends. He...
by baodog
Sun May 25, 2008 7:20 pm
Forum: Volume 114 (11400-11499)
Topic: 11454 - Very well informed domino player
Replies: 9
Views: 3220

Re: 11454 - Very well informed domino player

Isn't Alberto the problemsetter?

Go to advanced search