Search found 17 matches

by yaro
Tue Apr 05, 2005 6:30 pm
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 9392

The bug is here: void BigNum::operator =(BigNum &num) { memcpy(digit,num.digit,sizeof(digit)); } Your operator '=' doesn't return a reference to itself - it's useless. My G++ compiler also reports compilation error. This is the proper use of that operator: BigNum& BigNum::operator =(BigNum &num) { m...
by yaro
Fri Apr 01, 2005 11:48 pm
Forum: Volume 1 (100-199)
Topic: 107 - The Cat in the Hat
Replies: 278
Views: 19169

In this task you have to be careful about the precision errors. Even the 1e-5 precision may not work.. There is a way to solve this task using only integer numbers - just to implement some mathematical operations using ints.
And there is no need to use big num.
by yaro
Fri Apr 01, 2005 11:41 pm
Forum: Volume 107 (10700-10799)
Topic: 10722 - Super Lucky Numbers
Replies: 25
Views: 9392

It is not about a big number but the proper solution for this problem (for example some DP...), if you find it, using the big number won't cause TLE.
by yaro
Fri Apr 01, 2005 10:38 pm
Forum: Algorithms
Topic: Critical tests..
Replies: 3
Views: 1224

JackBauer wrote: TopCoder problems seam to be a little better in discribing input.
That's right but consider that TopCoder matches have quite different rules about "getting accepted".
by yaro
Mon Mar 28, 2005 1:13 pm
Forum: Algorithms
Topic: USACO help
Replies: 7
Views: 3931

1s? When I was doing USACO training it was 5 seconds.
O(nm) is the model solution, but it is smartly improved so that O(nm) occurs only in the worst case.
by yaro
Fri Mar 25, 2005 1:28 pm
Forum: Algorithms
Topic: DP - help please...
Replies: 5
Views: 1703

You can try these: http://spoj.sphere.pl http://acm.zju.edu.cn/ The problems are not divided into categories like DP, graphs etc. It is your task to determine whether the problem can be solved by DP or greedy, or in other way. You just need to read some of them and think about the method which shoul...
by yaro
Thu Mar 24, 2005 10:53 pm
Forum: Algorithms
Topic: DP - help please...
Replies: 5
Views: 1703

http://www.topcoder.com/tc?module=Stati ... d2=dynProg

I think this may be interesting for you.
by yaro
Sun Mar 20, 2005 11:24 pm
Forum: Algorithms
Topic: USACO help
Replies: 7
Views: 3931

My O(nm) solution passed all test cases (it worked 2.12 second at worse).
You should optimize your code to get it accepted.
by yaro
Tue Feb 15, 2005 1:13 am
Forum: Algorithms
Topic: Integer as sum of two squares of integers
Replies: 1
Views: 1187

Finding all prime factors of the form 4m+3 works pretty fast even for the numbers like 10^12. If you find all prime numbers not greater than sqrt(n) first, you only have to check pi(sqrt(n)) factors for given number later (where pi(x) denotes the count of prime numbers not greater than x). For examp...
by yaro
Mon Jul 26, 2004 6:32 pm
Forum: Algorithms
Topic: Help With USACO Problem
Replies: 13
Views: 3134

My algorithm works something like that: I sort rectangles' edges ('opening' and 'closing' edges) by x-coordinate. Then I start to sweep from left to right - for every event (edge parallel to y axis) I count the area (and also the colors) of rectangles which intersect or cover this event and next eve...
by yaro
Fri Jul 16, 2004 5:14 pm
Forum: Algorithms
Topic: Help With USACO Problem
Replies: 13
Views: 3134

Yes, sweeping worked out. My algorithm runs in O(n^2*lg n) time and it passed all tests.
by yaro
Sat Jul 10, 2004 9:01 pm
Forum: Algorithms
Topic: Help With USACO Problem
Replies: 13
Views: 3134

Hi,

I think in this problem you have to create some kind of sweeping (at the moment I'm thinking about that :). It's similar to calculating common area of rectangles, if you perform that counting colors will be easy.

yaro
by yaro
Sun Jul 04, 2004 12:46 pm
Forum: Volume 102 (10200-10299)
Topic: 10233 - Dermuba Triangle
Replies: 10
Views: 5840

OK, I found a mistake (switched int to long long) and got AC.
by yaro
Sat Jul 03, 2004 4:58 pm
Forum: Volume 102 (10200-10299)
Topic: 10233 - Dermuba Triangle
Replies: 10
Views: 5840

10233 - Dermuba Triangle

Hi,

My code got WA, I don't know why. Are there any tricky cases?

Thanks for any help.
by yaro
Tue Jan 27, 2004 6:07 pm
Forum: Volume 2 (200-299)
Topic: 270 - Lining Up
Replies: 48
Views: 15917

I tried many diffrent kinds of multiple input readings and nothing. Now I'm wondering about the type of coordinate, but I got upset with this task and now I'm doing something else.

Thanks

Go to advanced search