Search found 19 matches

by Lomir
Mon Nov 26, 2007 10:01 am
Forum: Volume 113 (11300-11399)
Topic: 11361 - Investigating Div-Sum Property
Replies: 16
Views: 6938

I think that, maximal possible K is 82. Because there are no numbers in inteval with larger sum of digits then 82.
by Lomir
Mon Nov 26, 2007 8:54 am
Forum: Volume 113 (11300-11399)
Topic: 11354 - Bond
Replies: 13
Views: 6655

I would like to know how the query can be answered directly on the union find datastructure. It is interesting to me too. I solved it just using LCA and calculated maximum edge cost from each vertex by 2^j vertices up. Then each querry also can be answered in O(log n). Answer is the maximum value f...
by Lomir
Fri Nov 16, 2007 12:40 am
Forum: Volume 113 (11300-11399)
Topic: 11349 - Symmetric Matrix
Replies: 43
Views: 19436

Read the problem statement once again.
by Lomir
Tue Nov 13, 2007 4:35 pm
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 43988

int for total cost is enought. We are not so cruel :)
Maximum answer is: 1766189.55$.

Maybe you used C not C++? I do not know how it works in C.
As far as C++ unsinged char must be used. Overway you will index array out of boundary and this is UB.
by Lomir
Tue Nov 13, 2007 2:20 pm
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 43988

Yes, test input was copied. However it was resaved in ANSI encoding. So, I think that no characters higher then 255 have left.

I use gets() and vector of 255 elements.
If there was some unicode characters I think you sould get WA. Because my solution work only with char/usigned char [0..255].
by Lomir
Mon Nov 12, 2007 11:52 am
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 43988

char ch = 255; ch is negative one ! but the clarification said that the character codes are non-negative. "character value" In clarification means the amount of money paid for character. There is nothing said about character code. So codes may be in range of 0-225, and you must use usigned version ...
by Lomir
Sun Nov 04, 2007 2:24 am
Forum: Volume 113 (11300-11399)
Topic: 11334 - Antenna in the Cinoc Mountains
Replies: 6
Views: 3966

11334 - Antenna in the Cinoc Mountains

Maybe somebody have some good testcases? My algorithm work like this: I make a plane at cone center that is penperdicular to xOy and our looking ray. Then i am looking to a point of ray and plane intersection. If this point is in segment interval, I check if its distance to a cone center axis is les...
by Lomir
Mon Oct 22, 2007 10:50 am
Forum: Volume 113 (11300-11399)
Topic: 11315 - Attacker
Replies: 10
Views: 3251

I think line sweeping will help us. Two intersecting rectangles will can always divide into three non intersecting ones. And non intersecting rectangles can be sorted by thier y value. So let's sort rectangles by their X cordinate. Now we will hold examined rectanges in RBTree by their Y cordinnate....
by Lomir
Mon Oct 08, 2007 1:49 pm
Forum: Volume 113 (11300-11399)
Topic: 11308 - Bankrupt Baker
Replies: 17
Views: 7519

To sapnil:
Thanks, I had the same bug :)))
However I think it must be a presentation error, but not WA.
by Lomir
Sun Oct 07, 2007 8:26 pm
Forum: Volume 113 (11300-11399)
Topic: 11308 - Bankrupt Baker
Replies: 17
Views: 7519

And why do you get WA at first?
I also got WA, but do not know why....
by Lomir
Tue Oct 02, 2007 6:50 pm
Forum: Volume 112 (11200-11299)
Topic: 11290 - Gangs
Replies: 8
Views: 3147

run R1 is more OG than a run R2 if and only if: R2 returns to the Green Line for the first time at an earlier point than when R1 returns to the Green Line, or R1 and R2 return to the Green Line at the same point, but the portion of R1 to that point (ignoring the initial E and final S) is more OG th...
by Lomir
Tue Oct 02, 2007 6:12 am
Forum: Volume 112 (11200-11299)
Topic: 11297 - Census
Replies: 24
Views: 14870

O(log(n)) time for 'c' query O(n*log(n)) time for 'q' query My n intervals work like this. I think c is less then q, cause got AC only in more then 6sec. 2d interval tree works here. Each query and update is O((log n)^2) I know, however i would code it whole night :) It's enoght for me to have n in...
by Lomir
Mon Oct 01, 2007 10:10 pm
Forum: Volume 112 (11200-11299)
Topic: 11297 - Census
Replies: 24
Views: 14870

I used N Interval Trees (a tree for each row) to get rather slow AC.
This is really nice problem, expcept for its statement.
by Lomir
Mon Oct 01, 2007 1:47 pm
Forum: Volume 112 (11200-11299)
Topic: 11297 - Census
Replies: 24
Views: 14870

"x1 y1 x2 y2" which represent the coordinates of the upper left and lower right of where you must calculate the maximum and minimum change in population. "x y v" indicating a change of the population of city C [x, y] by value v. q 1 1 2 3 c 2 3 10 q 1 1 5 5 q 1 2 2 2 Which input format is right? Th...
by Lomir
Mon Oct 01, 2007 11:24 am
Forum: Volume 112 (11200-11299)
Topic: 11299 - Separating Rods
Replies: 5
Views: 2411

We have a segment consisting from other segmest. For example second test: 1 1 10 We have segmens of length 12 (1+1+10). Now we can make K cut, however we can cut(divide) segment only in places where it is connected. With one cut from the previous segment we can get only 2(1+1) + 10 or 1 + 11(1+10). ...

Go to advanced search