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

Автор gen, 11 лет назад, По-английски

Hello, Codeforces!

I'm glad to invite you to participate in the online mirror of the Baltic Selection Contest for ACM ICPC 2015–2016 that will take place in Gym on the 22nd of October, 13:00 UTC.

This competition determines the best teams throughout the universities of Latvia, Lithuania and Estonia that will participate in ACM ICPC NEERC Western subregional contest in Minsk, Belarus. The onsite contest was held on the 12th of October. The participating universities were University of Latvia, Vilnius University, Kaunas University of Technology, Vilnius Gediminas Technical University, Estonian Information Technology College and others.

As a bonus, I'm posting some photos of the onsite action at University of Latvia. :)

The top 5 teams at the onsite competition were:

  1. LU: 64428b862de0207ba0385b1ed2df43e1 (Alex_2oo8, zmad)
  2. VU: 2B||!2B (vstrimaitis, jDomantas, JustasK)
  3. LU: 0x7DF (Pakalns, Candyman, A_Le_K)
  4. LU: leet (Instasamka, how_to_become_purple, JustN)
  5. KTU #1 (wi_lius, lukgar, ASBusinessMagnet)

The detailed onsite standings will be posted after the contest.

The problems were prepared by a group of authors from University of Latvia: gen, KarlisS, andreyv, cfk.

Good luck & have fun!

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

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

When I saw pictures I thought this is live LOL competition :D

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

.

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

Assassin's Creed — Coderhood

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

The cakes look so tasty!

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится
What a name... "64428b862de0207ba0385b1ed2df43e1". As if "2B||!2B" or "0x7DF" weren't good enough

Imagine how would their team's name would be announced at the closing ceremony

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

"She's beautiful"

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

Is there a way to do J without treaps ?

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

How to Solve B?

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

    So, a single leaked box covers a smaller triangle of boxes. In short, we maintain a set that contains the vertices of such triangles that have not been covered by any other triangle yet. When a box leaks (i.e., a new triangle is added), we find the vertices of the triangles that are inside the new one, and subtract the area that was first covered by this box and is inside the new triangle. Then we can remove them from the set and insert the new triangle vertex in the set. This results in solution (for each new triangle, there can be also two vertices that are not inside the new triangle, but overlap with it: these vertices remain in the set, but that does not change the complexity).

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

tfw your nickname is on the front page of Codeforces

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

How to solve K — Profact ?

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

How to solve H ?

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

How to solve C — Minimax Tree? Please!!!!!!!!

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

    You do a binary search for the answer (one binsearch for min and one binsearch for max) and then after this is fixed you can do a best[node]= minimum number of signs you need to use to get that element (or better) to the node.

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

How to solve E. Permutation Polygon?

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

    For every edge (x<->y), we need to calculate how many edges (p<->q) intersect it. In order to make sure that we are not overcounting, we'll only consider such edges (p<->q) where x < p < y < q [They surely intersect each other]

    We can do that in O(log n). Maintain a segment tree where a node in the segment tree having range [i..j], holds the end points of the such edges (u <-> v) such that i <= min(u,v) <= j, in sorted order.

    Now suppose we want to know how many edges (p <-> q) intersects with (x<->y) where x < p < y < q. To get this, we'll query on the range [x+1..y-1]. As we have the end points in sorted order in the segment tree, we'll binary search on y to get the answer.

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

    It can also be solved using two Persistent segment trees. For each edge a-b, the edges which intersect it are formed between the vertices [a+1, b-1] and one of the two intervals [1, a-1] and [b+1, N]. So we maintain two persistent segment trees inc[i] and dec[i]. Inc[i] stores the other end points of the edges formed by vertices [1, i] and dec[i] stores the other end points of the edges formed by vertices [i, N]. To find out the number of edges which intersect the edge a-b we query inc[a-1] and dec[b+1] for the interval [a+1, b-1]. Note that each edge will be counted twice so we divide the answer by 2 at the end.

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

Instead of having people asking about every single problem's solution, seeing editorial (even a simple and a short one) would be much better.

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

Is there any way to solve I — Shell's game without binary search? Thanks

  • »
    »
    11 лет назад, скрыть # ^ |
    Rev. 17  
    Проголосовать: нравится +12 Проголосовать: не нравится

    Yes

    It's rather easy to get formula of this radius. You know that sum of opposite sides should be equal and top side of needed size can be found using Pythagorean theorem. There will be two functions — one that describes sum of right and left sides and other for sum of top and bottom ones. Then you equalize them to get radius.

    — side of trapeze

    Answer is as there could be not enough space for ball that touches both sides.

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

      Thabks for your reply! Just to get this clear, problem asks us for biggest ball size that touches only inner surface and not necessarily bottom of the cup? I may of have rushed into solving it woth wrong assumptions, anyway, thabks for your reply!

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

Need some hint for K (Profact).
(Thanks in advance)

»
11 лет назад, скрыть # |
Rev. 4  
Проголосовать: нравится +44 Проголосовать: не нравится

I've collected the editorials in a single comment here, thanks for writing the solutions. I don't have much free time now, so mine explanations are very short. :|

A: Solve for each digit separately. Don't forget the case when the answer is 0, not to output an empty line.

B: #comment-258052

C: #comment-258117

Another solution: Say we need to compute the maximum. Suppose there is a labelling where a vertex u is a parent of a vertex v, u has at least two children, u is labelled max and v is labelled min. We can prove that swapping the two labels cannot increase f(1). If u had only child, it would be beneficial not to swap the two labels.

We can assume there are no vertices that have only one child, since they don't matter in the end result. Let's just put a max sticker in each such vertex, because the min stickers are more beneficial.

Another observation: if a vertex has two children with min stickers, one of them is redundant and we can change it to the max sticker.

Thus, a linear solution: with a single DFS for each subtree calculate the value that is obtained by placing only stickers max in this subtree. Then, with another DFS examine the paths from the root to each vertex; try to put all the min stickers in that path (except the vertices with only one child), and at the lowest vertex labelled with min pick the minimum value at its children from the first DFS.

D: Note that each move swaps the type of the land we are currently at. Thus it only matters to find the shortest path (in steps), we can do it with BFS. If its length is len, then the answer is .

E: #comment-258093

F: Observe that . Thus we can telescope the sum:

G: Hold a pointer to the current cell.

H: #comment-258085 #comment-258096

I: #comment-258126

J: #comment-258060 #comment-258077

K: #comment-258228

L: Just check all substrings of length 2.

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

Can any one point the problem of my code in problem D

i get WA in test 11