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

Привет, Codeforces!

28 апреля в 18:05 MSK состоится Educational Codeforces Round 20.

Продолжается серия образовательных раундов в рамках инициативы университета Harbour.Space! Подробности о сотрудничестве Harbour.Space и Codeforces можно прочитать в посте.

Раунд будет нерейтинговый. Соревнование будет проводиться по немного расширенным правилам ACM ICPC. После окончания раунда будет период времени длительностью в один день, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 7 задач на 2 часа 15 минут. Возможно, задачи покажутся многим чуть сложнее, чем в прошлые два раунда, но мы надеемся, что каждый участник найдет среди них задачу себе по душе.

Раунд вместе со мной готовили Иван BledDest Андросов и Михаил MikeMirzayanov Мирзаянов.

Желаю удачи на раунде!

UPD: Разбор доступен по ссылке

Поздравляем победителей:

Rank Competitor Problems Solved Penalty
1 Um_nik 7 129
2 bmerry 7 160
3 kmjp 7 191
4 KrK 7 212
5 rajat1603 7 235

Поздравляем лучших взломщиков:

Rank Competitor Hack Count
1 halyavin 135:-25
2 n.grechiha 20
3 oipotato 17
4 tqyaaaaaaaang 16
5 GreenGrape 16:-3

Было сделано 324 успешных и 209 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Problem Competitor Penalty
A kmjp 0:02
B RockyB 0:02
C Lewin 0:07
D Um_nik 0:15
E eddy1021 0:20
F tanphatls987 0:07
G ODT 0:33

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

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

Hope everyone enjoy the contest. :)

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

。

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

The duration in Contests list is 2 hours.

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

What is time complexity needed for acc on C? I can't belive didn't passed.I found all factors of n in and got sorted array.It's easy to see that gcd|n and so we need to find largest such that k|n and that's just binary search on array with factors.I was 100% sure that this will pass.. Really looking forward for solution!

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

Why is my solution for Problem C not passing.?

My idea is suppose that mid is the gcd of all the numbers then, the smallest form of the numbers is

A = 1*mid, 2*mid, 3*mid, ..., k*mid.

Now consider n-sum(A); This value must be a multiple of mid; simply add this remainder to the last item in A.

We can find mid by binary search.

My solutions always fails on test 14. I think my logic is wrong but why?

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

Problem G basically.

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

    One segment tree (used twice) is enough.

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

      i guess i did overkill as i had a normal segtree from [1..K] and a persistent segtree in each leaf node of this segtree.

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

      Can you please explain how?

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

        I just got AC with a normal segtree and an implicit segtree.

        What I did was maintain an implicit segtree over the range [1, N * K], and a normal segtree over the given array, i.e. [1, N].

        The invariant of the implicit segtree is that for every node, if it exists, it will store the correct minimum value of the range it represents. It will also store a lazy value, which if non zero, means that there was an update at some time on the range it represents, with the value of lazy.

        Now when you are updating on the implicit segtree, say the current node completely overlaps with the update interval, then I will mark the lazy value on this node as the current query's value, and free all the nodes in the subtree of this node, since they are not needed anymore.

        When I am querying, if I reach a node that completely overlaps with the query interval, and the node is allocated, I will just return the minimum value at this node (which is correct because of the invariant of the implicit segtree).

        If I reach a node that completely overlaps with the query interval, but hasn't been allocated, I will first see the lazy value of the closest allocated ancestor of the current node which has a non zero lazy value. If their exist an ancestor with a non zero lazy value, I will return that lazy value. If there doesn't exist any such ancestor, I will query over the segtree made over the original array, as this range hasn't been updated in any way.

        It's kind of hard to explain in words, you can try to read the code and see if it helps: Code

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

        Let's write down all values of l and r for all queries, sort them and remove duplicates. One can see that a range between two consecutive elements can be treated as a point (because no query splits it) and there're clearly O(q) such points.

        We can build a standard segment tree over this compressed array of query boundaries. Each position should contain a value equal to the smallest element in the given range in the initial array (we can find it using the same segment tree build over the input array. We need to handle "long" ranges carefully: if r - l > n, we can just return the minimum of the entire array). After that, each query is a range assignment/range max in this segment tree.

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

    so that's what div 1 people do after solving all the questions...make memes :P

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

Couldn't solve D because of writing while( ++idx && idx < n ) instead of while( ++idx < n )

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

Any idea how to solve F?

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

Is there anyone who may know how to solve problem F?

My solution is O(n log^2 max(a)) but I got TLE.

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

nice problems <3

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

Can anyone please explain the solution of problem C?

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

Why does iterating over an array of all divisors get TLE in C? Isn't the max number of divisors quite a small number?

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

Почему если среди двух решений с соревнования взломали второе, то в положении стоит -1?

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

In Problem E, I don't understand the line There is no hand such that the absolute difference before this hand was equal to k., can anyone please clarify?