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

Автор MikeMirzayanov, 12 лет назад, перевод, По-русски

Добро пожаловать на 2014-2015 CT S02E04: Codeforces Trainings Season 2 Episode 4 (US College Rockethon 2014 + COCI 2008-5 + GCJ Finals 2008 C). Продолжительность тренировки — 4 часа 30 минут. Тренировка открыта как для команд, так и для индивидуальных участников. После ее окончания вы можете дорешивать задачи тренировки или поучаствовать в ней виртуально, если не смогли принять участие одновременно со всеми. Пожалуйста, участвуйте в тренировке честно.

Так как это тренировка, то возможно набор задач будет расширен, если для значительного количества участников он окажется простым.

Условия задач будут на английском языке, ведь мы же готовимся к ACM-ICPC!

Удачи!

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

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

Haha I like the picture xD

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

GL & HF !

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

:\ It would have been nice to know about the gym contest/training in advance. Can you guys post this at least a day earlier to the start of contest?

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

How was problem A to be solved?

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

    Look at this problems in different way: You've got Mi man and Wi woman "fighting" for Si shoelaces. Greedy algorithms does the trick. Firstly, give all shoelaces to woman (because you're gentleman) and take back and give shoelaces to man until there are more woman with shoelaces. Don't do it one by one, but count how many you should take back for every color.

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

Tricky test for G?

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

how to solve I and J? These tasks made me confused!

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

    I: there's a DAG with at most 2 edges from each vertex; if a vertex is (position, last jump direction), you can make "dummy jumps" whose cost depends on whether the direction of the last and next jump are the same

    J: trie, offline (add the dictionary into the trie); in particular, all answers will be either the sum of LCP with all strings or the sum of LCP of s[i] with s[j < i]

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

      There are also lot of ways to solve J online — for example, by storing all entrances of every vertex of trie in some vector and using bin.search. And my first thought was about persistent trie — probably because i was solving CF#276 short time ago:)

      BTW, offline solution actually looks easier:)

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

My codes: A B C E G H I J K

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

How to solve G?

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

how to solve problem d

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

    You can calculate new coordinates of your raplaces, so you handle requests from the end, calculate on each step new coordinates. It's work with O(m) complexity.

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

    In problem D , the rotation and reflection (Mirror) can be done in O(1). In these cases only the starting position for row , starting position for column , direction of row , direction of column changes.Also in case of rotation the board inverts . The row becomes column and columns became rows( Something like that !!!). If you handle this cases and just simulate accordingly for replacing your work is done.

    My Code.

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

can u please post the editorials? Would be of great help...

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

Can anyone please explain G.

Xellos's solution and explanation seem like magic to me. It would be nice if someone could elaborate on the idea.

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

Problem F was really interesting. What was the intended solution?

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

    Let me start from the end to give the motivation for the rest. The following formula gives the solution to the problem:

    Let and

    With this formula it is trivial to get an O(k2k) algorithm, and fairly simple to get an O(2k).


    Now the derivation:

    Note:


    To count the number finished states, label them by the last station on each track that is on strike. There are states with each label.




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

Such a strong test cases... My AC solution for problem C (8689388) says IMPOSSIBLE for

3
100 100 100 100 100 100 100
100 100 100 100 100 100 100
100 100 100 100 100 100 100
100 100 100 80 70 60 100
100 100 100 25 100 50 100
100 100 100 20 30 40 100
100 100 100 10 100 100 100

Of course, correct answer for this case is

7
7 4