Блог пользователя chrome

Автор chrome, история, 10 лет назад, По-русски

Всем привет!

Завтра в 05:00 MSK, состоится Topcoder SRM 674.

Предлагаю обсудить задачи после контеста.

  • Проголосовать: нравится
  • +96
  • Проголосовать: не нравится

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Yaaah..... Hope the Problems will be interesting

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Wake up people, registration is open!

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Could someone explain their solution to 1000? I couldn't understand what the AC codes were doing.

»
10 лет назад, скрыть # |
 
Проголосовать: нравится -13 Проголосовать: не нравится

|num| <= 20 and O(N) passes...

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится
»
10 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

My solution to Div2 500: O(n^4)

The question can be rephrased as:

"Place the origin the orient the coordinate axes in such a way that you get maximum points on the axes"

So we know that if we have 3 distinct points, then we have can place the axes in such a way that the x-axis lies on 1st two points and the y-axis lies on the 3rd point. (This is because you can always place the coordinate axes in such a way that vertices of a triangle lie on the axes). So iterate over all triplets in O(n^3) and for a particular triplet, check how many points lie on the axes including these 3. The maximum will be the answer. I did a small silly mistake but my code passed the system tests later on. Hence overall complexity = O(n^3 * n) = O(n^4)

Code: http://ideone.com/vdyaTI

  • »
    »
    10 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Thanks, I gathered something like that from the solutions, but I keep thinking about the case where you have 3 points on a line, for this case the placement of the origin is still not certain as it could be translated along the y axis as much as you want and still contain all 3 points.

    Could you help me understand why it works in this case?

»
10 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Also, what exactly was the solution to Div 2 1000? No one actually solved it so I think it must have been a tough one. cgy4ever's solution suggests that it was DP+Bitmask.

Can anyone explain the solution?

»
10 лет назад, скрыть # |
 
Проголосовать: нравится +24 Проголосовать: не нравится

»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone help me with my D2 500? http://www.textsnip.com/13653a

I couldn't think of the integer-only solution. So instead I do this:

  for (each point p)
     translate all points so that p is at the origin
     for (each transformed point q)
         a = angle of q
         rotate all points by angle 2pi-a, so that q is on an axis
         count number of points on x/y axes using 1e-8 precision

I have a test case it's failing on, so I can figure it out eventually. But just wondering if it is the approach or is it the precision? Thanks!!