## Search found 385 matches

Sun Feb 15, 2009 2:20 pm
Forum: Volume 115 (11500-11599)
Topic: 11573 - Ocean Currents
Replies: 12
Views: 3808

### Re: 11573 - Ocean Currents

> junrajz
I used the same algorithm as you described. It got accepted in 0.65 s without any optimization.
Maybe some flaw in your code.

-----
Rio
Tue Oct 21, 2008 4:25 am
Forum: Volume 115 (11500-11599)
Topic: 11529 - Strange Tax Calculation
Replies: 7
Views: 1386

### Re: 11529 Special Tax

There's no need to enumerate through all O(n^3) triangles.

Hint: Given one point, think about how many triangles includes this point.
If this could be done in O(nlogn), the whole calculation could be done with O(n^2logn).
-----
Rio
Tue Oct 21, 2008 2:11 am
Forum: Volume 115 (11500-11599)
Topic: 11529 - Strange Tax Calculation
Replies: 7
Views: 1386

### Re: 11529 Special Tax

There's a non-random O(n^2logn) algorithm.

ADD: I also tried random algorithm, but couldn't get AC.
Didn't have enough accuracy.
----
Rio
Wed Aug 20, 2008 12:33 pm
Forum: Volume 114 (11400-11499)
Topic: 11432 - Busy Programmer
Replies: 12
Views: 4864

### Re: 11432 - Busy Programmer

he can not be away from any project for more than G consecutive days. (of course unless a project is already complete.)
aabaabbb
-----
Rio
Tue Aug 12, 2008 10:37 am
Forum: Volume 114 (11400-11499)
Topic: 11476 - Factorizing Large Integers
Replies: 17
Views: 8354

### Re: 11476

I have tried both Pollard and Brent versions for factorization and got TLE. However, the major bottleneck in my case is calculating (a*b)%c, where a, b and c are 64-bit integers, without an overflow. I am using O(log n) algorithm similar to fast exponentiation. Is there a way to speed up this compu...
Tue Aug 12, 2008 10:33 am
Forum: Volume 114 (11400-11499)
Topic: 11471 - Arrange the Tiles
Replies: 5
Views: 1527

### Re: 11471 - Arrange the Tiles

You could also get AC using simple Backtrack with a little trick.

-----
Rio
Mon Jul 28, 2008 6:23 am
Forum: Volume 103 (10300-10399)
Topic: 10340 - All in All
Replies: 129
Views: 32393

### Re: 10340 - All in All

Your code doesn't even pass the sample io.
Try to output it correctly, and you'll understand wheres your mistake is.

-----
Rio
Tue Jul 15, 2008 3:15 pm
Forum: Volume 114 (11400-11499)
Topic: 11463 - Commandos
Replies: 18
Views: 10307

### Re: 11463 - Commandos

There is no restriction in how many commandos you use.
If there is N buildings, think about using N commandos (one command for one building).

-----
Rio
Sat Jul 12, 2008 11:59 pm
Forum: Volume 114 (11400-11499)
Topic: 11468 - Substring
Replies: 2
Views: 1094

### Re: 11468 - Substring - WA

Got the same answer, and WA...

-----
Rio
Wed Jun 25, 2008 6:29 am
Forum: Volume 114 (11400-11499)
Topic: 11457 - Classified
Replies: 4
Views: 1151

### Re: 11457 - Classified

I found paper about it in the first page.
-----
Rio
Wed Jun 25, 2008 4:18 am
Forum: Volume 114 (11400-11499)
Topic: 11457 - Classified
Replies: 4
Views: 1151

### Re: 11457 - Classified

This problem is about finding LCA in DAG.

I used an algorithm with O(nm) for precalculation and O(1) for query.
-----
Rio
Mon Jun 23, 2008 7:29 am
Forum: Volume 111 (11100-11199)
Topic: 11160 - Going Together
Replies: 10
Views: 5756

### Re: 11160 - Going Together

I edited the test case.
-----
Rio
Sat Jun 21, 2008 9:25 pm
Forum: Volume 114 (11400-11499)
Topic: 11456 - Trainsorting
Replies: 20
Views: 10629

### Re: 11456 - Trainsort

Try this.

Code: Select all

``````1
10
3
8
1
5
10
4
9
2
7
6
``````
Correct output is 5 (10(or 9)-8-5-4-2) but your code outputs 4.
-----
Rio
Mon Jun 02, 2008 11:31 am
Forum: Volume 110 (11000-11099)
Topic: 11063 - B2-Sequence
Replies: 73
Views: 40343

### Re: 11063 - B2-Sequence

Part that has bug;

Code: Select all

``````      int pot = 1;
for(i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(a[i]<pot)b=0;
pot = a[i];
}``````

Code: Select all

``````      for(i=1;i<=k;i++)
{
for(j=i+1;j<=k;j++)
{``````
-----
Rio
Mon Jun 02, 2008 11:01 am
Forum: Volume 113 (11300-11399)
Topic: 11349 - Symmetric Matrix
Replies: 43
Views: 19691

### Re: 11349 - Symmetric Matrix

Actually, I'm having problems with understanding the problem description, should i cut the matrix vertically or horizontally to make the comparison to check whether it's symmetric or not ???? sorry but I'm little confused here :oops: and thanx in advance No, you don't have to. If the matrix is like...