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

Привет, Codeforces!

В Aug/14/2020 17:35 (Moscow time) состоится Educational Codeforces Round 93 (Rated for Div. 2).

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

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

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

Место Участник Задач решено Штраф
1 Um_nik 7 111
2 tmwilliamlin168 7 119
3 neal 7 144
4 Farhod 7 167
5 tribute_to_Ukraine_2022 7 178

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

Место Участник Число взломов
1 Dorost 13:-6
2 dcordb 3
3 bhatKa 4:-4

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

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

Задача Участник Штраф
A MikMirzoyanov 0:01
B tamahom1 0:02
C IAKWF 0:02
D shinigami11 0:09
E dorijanlendvaj 0:20
F nikolapesic2802 0:08
G tfg 0:22

UPD: Разбор опубликован

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

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

month of contests........... thanks CF

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

Month of contests...... thanks CF <3

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

how to hack ?

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

14th Aug — educational codeforces round 93

15th Aug — atcoder beginner contest 175, Facebook hacker cup round 1

16th Aug — codeforces Global round 10

I am really excited!

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

thanks to codeforces for back to back contests.

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

can anyone tell me the soultion approach of codeforces div 2 664 c problem. http://codeforces.me/contest/1395/problem/C

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

Standard Div2 round vs Educational round , which do you think is tougher ?

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

where is the comment-As a Tester give me a contribution..LOL

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

Educational round is love

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

what is the scoring distribution?

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

Lucky month for competitive programmer

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

good contest

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

I got covid 19, I am on my fourth day of isolation. I'm not feeling very well, but codeforces has helped me a lot to distract myself, wish me luck in this contest

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

I don't really understand why they say "6 or 7 problems". Aren't they sure about the number of problems till the last minutes?

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

Let us see what are we going to have today, weak pretest, long queue, complicated problem statement or all of these together.

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

Let us see what are we going to have today, long queue, weak pretest, complicated problem statement, or all of these together.

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

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

Am I only one who couldn't access codeforces for almost an hour during the contest? (I posted this and got downvoted, idk why).

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

It seems nowadays codeforces has better problems than atcoder... — aid

just look at problem G today and you'll find you were wrong.

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

It was really an educational round reminded me to study ..

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

I got problem A wrong, than was stuck on it to realise my initial idea was correct. Skipped B and went to solve C, cause I couldn't improve ranking at that point. Never solved C, I'm starting to believe I am dumb at this point...

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

What a nice contest but I think D is a little easy with typical DP

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

how to solve C please help

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

Problem D.... why????

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

Solutiom of C in less than O(n^2)..??

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

    i think it should be O(n) using hash map or something

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

    After getting the prefix sums
    Basically what you need to find is $$$pref[r] - pref[l - 1] = r - l + 1$$$
    Equating that it becomes $$$pref[r] - r = pref[l - 1] - l + 1$$$
    So at index i you need to count the indices $$$j \lt = i$$$ with $$$pref[i] - i == pref[j - 1] - j + 1$$$

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

What was testcase 7 of problem D?

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

Getting AC in D in like 10 mins but not getting any logic whatsoever for C hurts a lot.

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

I think C is more difficult than D...T^T.. How to solve C?

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

It was really good round, my nickname is lying :)

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

How to solve E? Can it be solved using set and priority_queue.

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

please anyone tell what's wrong in my solution in D (it's giving WA on test#7)

https://codeforces.me/contest/1398/submission/89953351

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

can anyone help me out? I can't figure out why i failed test case 2 for problem c. I have created a consecutive sum array(i dont remember the actual name) and then checked for windows of all sizes.89943421

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

C is a standard problem often asked at AtCoder beginner rounds.[the idea is just to use prefix sums]

Edit: finally question reduces to find (i,j) pair such that j>i && pre[j]-pre[i]=j-i which can be easily solved using map.

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

Any idea what is test case 2 of E or what is wrong with my idea?

My idea was as follows:

If after any operation we have $$$k$$$ lightning spells, then we need to keep track of the sum of the $$$k$$$ most powerful spells, while ensuring at max $$$k - 1$$$ of those are lightning spells (use a fire spell of power 0 as a dummy spell if needed). We can maintain the non-doubled spells using multisets in descending order and the doubled ones using multisets in ascending order for both types of spells. Change in sum can be tracked at the time of transistion of elements between these sets. Is the idea wrong or did I go wrong somewhere in implementation?

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

Hello, what was the idea in problem D? I assumed that it's always optimal to choose the first two biggest sides of different collor and add the area to the answer. I am really curious to know the problem since I got wrong answer on test 6!

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

Why greedy does't works for D??

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

What's the test 4 for problem E? I was using two sum segment tree one for lightning spells with twice the value of d and another for fire spell for value d. Also tracked minimum of lightning spells and maximum of fire spells by set and then computed the answer. Resulting WA on test 4.
89951160
In my submission, vectors are defined as sum -> lightning, sum2 -> fireball, v -> lightning, v2 -> fireball, st1 -> lightning, st2 -> fireball

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

Really nice Problemset :-)

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

Any counter examples for this approach for D? sort R,G,B in descending order.

Repeat:

1. LET MAXR,MAXG,MAXB be max values in R,G,B.
2. FIND BEST OUT OF <MAXR,MAXG>, <MAXG,MAXB> AND <MAXB,MAXR> and add product to final answer.
3. increment indexes for pair we got in 2.

My approach failed on pretest 6, but I would like to know a minimal example. I had to go with dp finally.

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

In E I had to query the sum of the k largest elements. Is there a data structure that supports this?

I used a messy combination of segment and fenwick trees and the fact that we know all elements before.

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

educational.jpg

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

Weak test cases in problem C

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

Ciao Rating !

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

This game really pisses me off

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

In question D, why do we have to sort the arrays before applying DP, i code it without sorting but it was giving wrong ans but after sorting with same logic it was giving right ans?

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

Too sad, I can't implement E in time (in 30 mins) :((. How can I improve my coding speed

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

About problem C: Let's consider s[l], s[l+1], .., s[r] so if s[l]+s[l+1]+..+s[r] = r- l + 1 then s[l..r] is good s[l]+s[l+1]+..+s[r] = 1 + 1 + 1 + .. + 1 (r — l + 1) s[l] — 1 + s[l+1] — 1 + ... = 0 so the problem switches to finding the number of subarr (after decreasing by 1 each element) which has sum = 0 (can be easily done by map)

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

It seems testcases are weak on problem E, this slow solution passes. Go ahead and hack it! 89956850

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

Here's a simple alternate for C: Decrease all the values in the array by 1, and now you need to find the number of subarrays which has sum equal to 0.

Btw, how to solve F?

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

    Let's try to find the answer for each len $$$l$$$.

    • Let $$$f(pos, len)$$$ = maximum possible number of sets that could have already finished considering $$$s[pos::]$$$ and number of contiguous rounds required is $$$len$$$.

    • Now, If $$$s[pos], s[pos+1] ...s[pos+len-1]$$$ doesn't contains both $$$1$$$ and $$$0$$$ then $$$f(pos,len) = 1 + f(pos+len, len)$$$.

    • Otherwise, find the minimum index $$$idx$$$ in $$$(pos, pos+len-1)$$$ such that $$$s[idx], s[idx+1]..s[pos+len]$$$ doesn't contains both 1 and $$$0$$$ and then $$$f(pos, len) = f(idx, len)$$$.

    The time complexity of the solution will be $$$O(N+N/2+N/3...) = O(Nlog(N)).$$$

    • The solution was simple but I was not able to prove that time complexity is $$$O(N(log(N))$$$ but the the basic proof is that lets in one iteration you are going from $$$pos$$$ to $$$idx1$$$ where $$$idx1$$$ can be $$$pos+1$$$ but in the next iteration you will definitely jump from $$$idx1$$$ to $$$idx2$$$ such that $$$idx2 \gt = pos + len$$$ thus at max total $$$2 * (N/len)$$$ iterations will be there for a single $$$len$$$.
    • »
      »
      »
      6 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      How do you perform step 3?

      I use Segment Tree, so the total complexity is O(n*log(n)^2), and my submission runs in ~1.9s, nearly TLE.

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

        For every index, Calculate the previous index such that it has one and also the previous index such that it has zero.

        • $$$if(s[pos+len]== ?)idx = min(prev_zero[pos+len], prev_one[pos+len]) +1$$$

        • $$$if(s[pos+len]==1)idx = prev_zero[pos+len] + 1$$$

        • $$$if(s[pos+len]==0)idx = prev_one[pos+len] + 1$$$

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

    Can you elaborate more on this?

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

      Short proof:

      $$$ \begin{align} & \sum\limits_{i=l}^r a_i = r - l + 1 \\ \implies & \left( \sum\limits_{i=l}^r a_i \right) - (r - l + 1) = 0 \\ \implies & \left( \sum\limits_{i=l}^r a_i \right) - \left( \sum\limits_{i=l}^r 1 \right) = 0 \\ \implies & \sum\limits_{i=l}^r (a_i - 1) = 0 \end{align} $$$
      • »
        »
        »
        »
        6 лет назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        I understood this proof but why we use frequency to calculate the total answer ?

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

          The goal is to find all possible $$$l$$$ s for our current $$$r$$$.

          Let $$$prefix(i) = A[1] + A[2] + ... + A[i]$$$. Suppose our current prefix sum $$$prefix(r) = x$$$. Since $$$prefix(r) - prefix(l-1) = A[l] + A[l+1] + ... + A[r-1] + A[r]$$$, then for all $$$j \lt r$$$ such that $$$prefix(j) = x$$$, we know $$$prefix(r) - prefix(j) = 0$$$. We keep the frequency of every $$$prefix(j)$$$ to search for how many of them are equal to $$$x$$$.

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

            Thanks very much . i understood this approach very will.. but in general how can i know like these proofs by myself in the contest !? any suggestions to improve my skills ?

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

              The trick with using prefix sums to calculate subarray sums is very common because it has so many uses. This particular problem is one that comes up every so often. You just need to keep practicing so that you'll learn these new techniques and remember them for future contests :)

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

    think of the brute force solution then optimize it, you can find the answer for any x in O(n) like this

    pseudocode

    this obviously takes $$$\mathcal{O}(N^2)$$$ but we can make it $$$\mathcal{O}(N * log(N))$$$, first for each i compute X[i] = biggest x such that $$$[i, i + x - 1]$$$ doesn't contain both 1s and 0, this can be done in O(n log n) using binary search and prefix sums, now in the loop above replace i += 1 by i = find(i, x) where find(i, x) returns the first j > i and X[j] >= x, this can be done using disjoint-set (initialize the parent[i] as first j > i with X[j] > X[i]) and modify the find function slightly

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

could E BE more boring ?

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

i see the answer for "C. Good Subarrays" in this content but i still can't understand it can any one help me?

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

W

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

In problem D why is it important to sort. . . . My thinking, If I'm using exhaustive search using dp, it should give the optimal answer, int this case max area, without even sorting. Please clarify this for me. Thanks

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

    Let's say we have two pairs of one type with lengths $$$a_1, a_2 (a_1 \le a_2)$$$, and two pairs of another type with lengths $$$b_1, b_2 (b_1 \le b_2)$$$, then it's optimal to create a rectangle of sides $$$a_2, b_2$$$ and a rectangle $$$a_1,b_1$$$. This is easy to prove.

    So, after sorting once we pair $$$i$$$ on first array with $$$j$$$ on second array, we'll never pair $$$k \lt i$$$ on first array with $$$z \gt j$$$ on second array. So we keep a classic DP.

    $$$dp[i][j][j]: $$$max total area using pairs till $$$i$$$ on first array, till $$$j$$$ on second array and till $$$k$$$ on third array.

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

    If I'm using exhaustive search using dp

    No we are not doing exhaustive search , if we are pairing one from red and one from green , they must be of highest length in there category .

    Did you asked yourself how transition will take place (i.e how we will find $$$dp[i][j][k]$$$ with the help of some lower $$$i,j,k$$$) ?

    $$$dp[i][j][k] = max(dp[i-1][j-1][k]+A_i*A_j,dp[i][j-1][k-1]+A_j*A_k,dp[i-1][j][k-1]+A_i+A_k)$$$

    while taking $$$A_i*A_j$$$ , we will take the maximum ones and thus we need to sort.

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

Please provide a test case where Greedy approach in problem D fails

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

How to solve $$$G$$$ without bitsets? Faster than $$$O(X^2/32)$$$

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

Problem C becomes so beautiful after realizing its logic.

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

    One more solution to solve such types of problems.

    Let $$$pref[i] = s[1] + s[2] ... + s[i]$$$

    Thus required subarrays $$$(s[L...R])$$$ will follow this property,

    • $$$pref[R] - pref[L-1] = R-L+1$$$

    • $$$pref[R] - R = pref[L-1] - (L-1)$$$

    Or, Basically you can choose any two index such that their $$$pref[i]-i$$$ is samefor both of them. Now, it's basic $$$O(N)$$$ task, using $$$C(freq, 2)$$$ for every frequency of $$$pref[i]-i$$$.

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

I have submitted 2 identical solutions for problem C. Solution A: 89960181 Solution B: 89960214 The only difference between the two is on line 22: In one approach I use an integer to represent the index while in the other I use a long long. I also use in both cases a long long to represent an index in line 53.

Why does one solution pass while the other doesn't? I've already read many forums regarding the indexing on arrays in C++. Nowhere did I found that it says that a long long will cause problems when indexing with it.

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

O(n) solution of C with HashMap 89943214

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

why the greedy solution of D — "pick two largest pair every time" fails?

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

Why is my approach for C failing? My approach: Every good subarray should start with some index, so i'll brute force for every index checking it for lengths (1,2,...9) . Time complexity O(9*n). It failed for many, example => s = "11140000000090000000002111" , correct ans = 37 , my ans = 29

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

My approach for C is I stored arr[i]-1(sum of a single element is arr[i] and length 1 ) in the array and found all subarrays with sum 0 all they are all complete (means they have sum and difference of length 0).. Hope IT will not get hackd:)

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

in c i storedd arr[i]-1 for each array and counted the no of subarrays with sum 0 balancing excess with shortage!

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

why my code for D is giving TLE. It is using same approach as DP solution.

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

My screencast, if you want to enjoy my fingers suffering from typing so much (video solutions for A-E included)

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

Why are the hacks shown on the hacking page in reverse order, like the most recent hack is at the end?

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

If anyone has used memoization for D pls do share your code.It would be a great help for a beginner like me as i am learning dp . Thanks in advance

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

Got WA on Test 6 in Question D. The 6th test case given is not intuitive.Can anyone help me out with a intuitive test case similar to the test which is used in testing.My solution is a greedy approach, but not a general one.So test cases such as the below test case will result in correct answer.This is my solution 89953296.

4 2 2

3 3 3 3

4 4

4 4

This test case results in correct answer for my solution.

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

I guess people are making fake ids just to hack those submissions afterwards. Deliberately a stupid if case is added to be hacked afterwards XD.

89940459

The hacked guy likes 78788 a lot I guess. One more of his solutions from another contest using his fake id Noob_is_back got hacked. See this 87193319 and you'll find 78788 again in the code. The hackers are still grey :)

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

My hack has been on "waiting" since this morning. It's not just when I'm logged in, it shows up like that on an incognito tab as well.

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

In the meantime before editorial is published and for those interested, here is the 3Blue1Brown styled visual editorial for Problem C, visualizing tmwilliamlin168's code (89883985). I have also given a somewhat formal proof before visualizing 1st input of Test Case #5

Link to visual editorial here

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

how to check the time it takes for the submission when hacking?

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

I love problem D very much!!

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

    How to solve E?

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

      I use the line segment tree (weighted segment tree). In fact, it is easy to find that the answer to problem E each line:ans = the sum of the largest number in the first K + the sum of all the numbers (here K refers to how many numbers can be doubled)

      Then we read all the values first, sort them (discretize them), and then read the input of the problem again (which has been changed by array storage in advance)

      We maintain the weighted line segment tree every time, that is, we ask the sum of the top k numbers in the 1-n interval every time. For example, to find the sum of the top 4 numbers, I will first ask whether the number of the right subtree (because the number stored on the right is larger than the number on the left) is less than 4. If so, enter it directly and return the sum of the top 4 numbers under the right subtree. If not, directly Select the sum of the prior numbers of the right subtree and add the sum of the first k = 4-num [RS] numbers under the left subtree (Num [RS] represents the first number of the right subtree),and then return it.

      In short, the answer is to ask the sum of the top k numbers on the line segment tree and add the values of all the current numbers

      (PS: but note that if the minimum value of all the numbers that can be doubled is greater than the maximum value of the number that can't be doubled, we can't simply choose the top k, but we should choose the top K + 1 and subtract the minimum value of the double number, because one can't double itself.)

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

      Maybe my expression is not clear, but you can find ideas from it. It must be feasible because I passed after the contest.

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

any news about the tutorial?

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

why this code 89922404 for problem C won't get TLE

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

Why are Educational Rounds always so late with editorials?

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

Can someone help me in D. I used a 3d dp approach, which finds the maximum value using 6 cases. However, it failed on test 5. Here is the failed submission, while here is the one that passes. What does sorting do?

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

    It's always optimal to chose pairs with the maximum product. So we sort those three lists in decreasing order and take pairs from top of them. But when we have multiple options for pairs with the maximum product we don't know which one we should take without looking at the next values and that's why we do dp.

    $$$dp_{i,j,k} = max(dp_{i,j+1,k+1},dp_{i+1,j+1,k},dp_{i+1,j,k+1})$$$ = maximum area we can achieve when we have already taken first $$$i$$$, $$$j$$$ and $$$k$$$ values of the first, second and third array (according to $$$0$$$ based indexing).

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

      I found your explanation easy to understand, can you tell what does dp[i] [j] [k] stands for i.e what is the meaning of each cell of dp, can you please elaborate it more.

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

        $$$dp_{i,j,k}$$$ stands for the state where we have already used first $$$i$$$ values of first array, first $$$j$$$ values of second array and first $$$k$$$ values of third array.
        The value of $$$dp_{i,j,k}$$$ is the maximum area we can obtain using remaining values of these three arrays in this situation.

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

If anyone need Explanation & implementation(not a video tutorial) for C Here

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

Has the system testing finished? Its been more than 12 hrs right? Also editorial please...

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

I think a coincidence has occurred. I write every problem's code by myself. Before Each code I wrote my name and time.

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

This wasn't a part of the problem, but I was wondering what is the maximum number of rectangles that can be formed for problem D?

My approach

Please correct me if I am wrong.

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

Is there a bug in the rating change of this round? Everyone seems to be one step down to their original rank

Edit : it is correct now

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

in D ,why do we have to sort the values,even though we are using dp?

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

    Because it is not subset dp like knapsack, we are just using dp on the number of elements chosen for each color,and we will chose that greedily, its always to better to chose highest two elements, but the choice of elements could restrict choice of other elements, hence we are using dp.

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

waiting for editorial..

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

Dear Codeforces administrators and contest organizers:

Just now, I received the following message:

Your solution 89920639 for the problem 1398D significantly coincides with solutions yhf_2015/89920639, zstuyyyycccbbb/89946825, Gghost/89949025.

First of all, I promise that the game was completed by myself alone. I did not listen to anyone else's thoughts during the game, nor did I reveal my thoughts to anyone. I have no intersection with the two who gave similar codes.

Secondly, my thinking about problem D is straightforward and simple. I think many people may have the same thinking. With a huge base, this may really be an accident.

I was very surprised when this happened, and I don't know what kind of evidence I need to provide to prove what I said above. (If you need me to provide any evidence, I will fully cooperate.) After completing the problem, I immediately carried out the research of problem E and wrote the code. Unfortunately, due to some errors, it was not possible within the game time Used.

Regarding my IP address, the network provided by my broadband network operator cannot access your site smoothly. I used a VPN system to compete through the lines of other operators. I don't know whether this will affect your judgment.

The above English uses machine translation.

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

Nice contest with great set of questions worthy attending it

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

Can anyone please explain why do we use FFT to get whether a value (a[i] — a[j] == t) for some i,j and t is possible or not ?

Asking this because if we can get all possible values of t from the array a.. then we can simply use sieve and solve but i am not getting the fact why do we use fft ?

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

Can Anyone please explain solution of 1398E - Two Types of Spells .There is no editorial and i cant think of any solution. or atleast give hint about data structure to use.

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

    Segment tree and multiset are sufficient. assume there are L lightning spells, you just need to know the first L largest power of magic spells ... and some annoying implementation.

    since all the powers are positive integers, you will always put the smallest lightning spell in the first position. then if there exists at least one fire spell, you can get L spells doubled. else you can only get L-1 spells doubled(since the last spell will be lightning spell).

    sorry for poor English, I'm trying to improve it by answering questions.

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

I get it in Problem D we have to first sort before applying dp, but I sorted all three array in descending order ( just applying the logic that since we need bigger ones first) but I got WA.
Can someone please explain the difference ?
AC. WA. Only difference between two is the way of sorting.

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

Editorial please, it seems to be taking forever.

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

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

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

Anyone with editorials for this contest .

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

hacks of rafaelka

:|

UPD : It is deleted now.

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

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

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

How come I wasn't able to hack anyone during the hacking phase? Did anyone else experience this? I think many wrong solutions got AC in this contest.

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

Can anyone tell how to solve problem C ? I saw youtube tutorials for this but couldn't get the logic.

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

Can someone suggest me questions similar to problem C

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

it was the first time I hacked someone's solution and coming out as one of the best hackers !! I feel happy :) Thank You Codeforces