emorgan's blog

By emorgan, 3 years ago, In English

Hi everyone!

The Final Round of Technocup 2022 starts this Sunday, March 20, 2022 at 11:00 MSK (09:00 UTC)!

The final results of the Technocup Final Round >>>

For those who want to compete on the same problems, we will hold a regular Codeforces Round, combined for both divisions. The round is starting at Mar/20/2022 14:35 (Moscow time).

If you are a participant of the official Technocup Finals, you are not allowed to take part in the round 778. We ask participants of the official Finals not to discuss the problems in open media till evening.

This round is possible thanks to the following people:

Score distribution: $$$500 - 750 - 1250 - 2000 - 2500 - 3000 - 3500 - 4000$$$

UPDATE: Editorial is out

UPDATE: Congratulations to the winners:

  1. Golovanov399
  2. orzdevinwang
  3. Rewinding
  4. xtqqwq
  5. ugly2333
  • Vote: I like it
  • +279
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it -46 Vote: I do not like it

I hope I can get to blue, although that's impossible for me.

»
3 years ago, # |
  Vote: I like it +26 Vote: I do not like it

Please no boring&standart segment tree problems, dont repeat mistakes of the previous 2 years... Please...

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +61 Vote: I do not like it

    Are interesting and original segment tree problems ok?

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +47 Vote: I do not like it

      2D segment tree beats

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +44 Vote: I do not like it

        For people who don't know the meme: at RMI I thought I had to implement a merge sort tree beats (only chmin), and I didn't realize that merge sort tree already contains all the necessary information to process chmin.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +13 Vote: I do not like it

      For sure :)

»
3 years ago, # |
  Vote: I like it +61 Vote: I do not like it

Clashing with ABC 244 :(

»
3 years ago, # |
  Vote: I like it +4 Vote: I do not like it

I will lose blue in this round

»
3 years ago, # |
  Vote: I like it +23 Vote: I do not like it

as a tester, the problems are pretty neato burrito!!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I didn't know envy was a tester lol

»
3 years ago, # |
  Vote: I like it +46 Vote: I do not like it

Is this the remorphed version of "Go Study Round 1"?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +55 Vote: I do not like it

    This is the problem set that was originally intended for Go Study Round 1. It's possible that the Go Study round could still happen in the future with a different problemset, but I don't know anything about it.

»
3 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Both the UTC and Moscow time are incorrect. Please rectify.

»
3 years ago, # |
  Vote: I like it +84 Vote: I do not like it

As a tester, I don't remember having so many positive feelings about a problemset. I had a lot of fun testing, and I am sure you'll enjoy the contest, too!

»
3 years ago, # |
Rev. 2   Vote: I like it +17 Vote: I do not like it

If there is no particular reason for the unusual time then I would like to request to authors and coordinators of this round to please shift it to the usual time so it doesn't clash with AtCoder Beginner Contest 244 and we can have a nice 35 minutes break.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    It clashes with ABC 244 not ARC 137

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Timings of CF round will most probably not be changed as it is based on Technocup finals.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    At 11 o'clock Moscow time, as it was written in the announcement, the Russian Olympiad for schoolchildren Technocup starts. Obviously, the round based on this Olympiad should not start much later, because otherwise the participants will have time to tell all the tasks and their solutions

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Expected to get cyan after this round.

»
3 years ago, # |
  Vote: I like it +9 Vote: I do not like it

Unusual time again :(

»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Why 8 problems in 2:15 and not in 3 hours?

»
3 years ago, # |
  Vote: I like it -29 Vote: I do not like it

hello sir, may i knwo how to be a tester, for the april fools round 2022 ?

Thnks

»
3 years ago, # |
Rev. 2   Vote: I like it +11 Vote: I do not like it

I am looking forward to this round, but emorgan, did you write 2022 as 2021 in the first sentence?

upd : I'm glad to see that this problem has been fixed.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it -39 Vote: I do not like it

    I'm glad to see that you're glad to see this problem has been fixed.

»
3 years ago, # |
  Vote: I like it +4 Vote: I do not like it

I was really looking forward to giving both Atcoder ABC and this round but looks like I am gonna have to choose.

»
3 years ago, # |
  Vote: I like it -35 Vote: I do not like it

What fuck?! It's time is as same as ABC244!

»
3 years ago, # |
  Vote: I like it -49 Vote: I do not like it

Orz USA Round!

»
3 years ago, # |
Rev. 2   Vote: I like it -25 Vote: I do not like it

:)

»
3 years ago, # |
Rev. 2   Vote: I like it +2 Vote: I do not like it

Can someone please explain what does it mean by Div 1 + Div 2 ?? Is it a combination of two rounds?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    It means it will be rated for both div1 and div2 and questions could be expected to have difficulty accordingly. Like generally, these 2 are held separately. To get a better idea go through other div1+div2 rounds' questions. All the best btw.. :)

»
3 years ago, # |
  Vote: I like it +45 Vote: I do not like it

It clashes with AtCoder Beginner Contest 244 :(

»
3 years ago, # |
  Vote: I like it +17 Vote: I do not like it

I hope I will become CM tonight

»
3 years ago, # |
  Vote: I like it -10 Vote: I do not like it

firs time on rated. lets go green :'v

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Good luck to everybody and myself. hoping to get green :)

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Score(A+B) == Score(C)

»
3 years ago, # |
  Vote: I like it -24 Vote: I do not like it

Round will it not be rated?

»
3 years ago, # |
  Vote: I like it +44 Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

»
3 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Bye ! expert

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to do C?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Store all the values in the array in a map. Find the sum and use recursion to see if you can construct the number backwards.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How didn't you get tle? The recursion can visit 2*sum nodes no?

      • »
        »
        »
        »
        3 years ago, # ^ |
        Rev. 2   Vote: I like it +5 Vote: I do not like it

        But we should stop it as soon as the resulting array's size exceed n , since if you observe the number of nodes we get in resulting array always increases by atleast 1 at every step of recursion.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          But if you stop how do you check if the current elements in the resulting array can reach the elements from the original array that you are trying to get?

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            With the map he mentioned, each time you get to an element of the array it increases total by 1. If total is equal to n at the end, the answer is yes.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        As a matter of fact, what you should do is to store the values together. It means that if you have k numbers of i, you can divide them into k numbers of i/2 and (i/2+i&1), which speeds up the whole process.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        No, because of short circuiting. You can take a look at my submission here (Ignore the sort beforehand, it doesn't do anything I just forgot to take it out) : https://codeforces.me/contest/1654/submission/150261342

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Interesting. I did the exact same thing though and TLEed. Is it something i am missing or is it jus that i am using a multiset? 150259740

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
              Vote: I like it +3 Vote: I do not like it

            You are missing the short circuiting part. The way your code is written now, it will continue to try to look for possibilities even when found that the number cannot be constructed. I made a couple of changes to your code here and got AC

            • »
              »
              »
              »
              »
              »
              »
              3 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Ok I see. Thank you very much!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Keep dividing the biggest piece of the cake if it exists delete it if not then it should be bigger than the biggest number in array a because if the biggest piece you have right now is smaller than the biggest piece in array a then you can't achieve that number

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone explain why does this code gives wrong answer on Problem D 150270389

»
3 years ago, # |
  Vote: I like it +39 Vote: I do not like it
meme
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is F 2^27?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    It should be $$$O(n2^n)$$$, but I'm still debugging my code due to some annoying border cases.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +28 Vote: I do not like it

    It can be solved with classic suffix array construction. If you sort prefixes of length $$$2^k$$$ for every $$$j$$$, then

    $$$s_j s_{j \oplus 1} \dots s_{j \oplus 2^{k+1}-1} = (s_j s_{j \oplus 1} \dots s_{j \oplus 2^k-1})(s_{(j \oplus 2^k)} s_{(j \oplus 2^k)\oplus 1} \dots s_{(j \oplus 2^k) \oplus 2^k-1})$$$

    Thus, you can compare prefixes of length $$$2^{k+1}$$$ by comparing pairs of prefixes of length $$$2^k$$$.

»
3 years ago, # |
Rev. 2   Vote: I like it +9 Vote: I do not like it

How to solve E?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I want to know this too

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it +13 Vote: I do not like it

    My approach is as follow:

    Let $$$b_i=a_{i+1}-a_{i}$$$ for $$$1\le i<n$$$

    If final $$$|b_i|> \sqrt n$$$,there will be less than $$$\sqrt n$$$ elements not being operated. Calculate for every $$$i$$$ with brute force is okay.

    Otherwise we have $$$|b_i|\le \sqrt n$$$ we can calculate the most remaining element for every $$$b\in[-\sqrt n,\sqrt n]$$$. We can classify every $$$a_i$$$ with $$$a_i-(i-1)b$$$.

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it +22 Vote: I do not like it

    Either $$$|\text{difference of AP}| \lt \sqrt{a_{max}}$$$ or $$$len(AP) \lt \sqrt{a_{max}}$$$.

    We can check for all possible differences in the first case in $$$O(n \sqrt {n})$$$

    In the second case realize that for a difference $$$d$$$, the difference between two terms at positions $$$i \lt j$$$ must be $$$(j - i) \cdot d$$$. Since $$$|d| \gt \sqrt{a_{max}}$$$, this will exceed $$$a_max$$$ in at most $$$\sqrt{a_{max}}$$$ steps.

    Unfortunately I didn't realize that the initial statement directly gives you the way to solve the second part during contest T_T.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    You need to find maximum sub-sequence $$$i_1, \dots, i_m$$$ such that for each $$$k$$$ in the sub-sequence

    $$$a_k = b \cdot k + c,$$$

    where $$$b$$$ and $$$c$$$ are some constants. If $$$i$$$ and $$$j$$$ both belong to the sub-sequence, then

    $$$b = \frac{a_i - a_j}{i - j}.$$$

    But $$$|a_i - a_j| \leq 10^5$$$, so either $$$|b|$$$ or $$$|i-j|$$$ is less than $$$\sqrt{10^5}$$$.

    So, you check all $$$b$$$ that are smaller than $$$\sqrt{10^5}$$$ and also all sub-sequences that their width is at most $$$\sqrt{10^5}$$$.

»
3 years ago, # |
  Vote: I like it +16 Vote: I do not like it

why the memory limit of D is 256MB. My program can't pass only because of this limit. I think this problem would be better if it's memory limit is 1GB

  • »
    »
    3 years ago, # ^ |
      Vote: I like it -8 Vote: I do not like it

    I think we both tried prime factorisation. Apparently it isn't the intended solution

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it

      i didn't do prime factorisation. and i think my program's memory is not so big.code[submission:150269946]

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Nevermind. The editorial's solution is doing exactly what i did in my solution (using maps to maintain prime factorisation). Now I am curious to know how the people who got AC implemented the same.

»
3 years ago, # |
  Vote: I like it +29 Vote: I do not like it

Great problemset, thanks to authors!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it -41 Vote: I do not like it

    How do you say this is a great problemset when you haven't even participated in it? Do you have an alt account?!

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How difficult...TAT

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the reason for higher time constraints on the problem 1654B - Prefix Removals?

This N^2 150248852 submission passes because of that.

And I also have a failed hacking attempt on it :-/

  • »
    »
    3 years ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    This is actually $$$O(26 * n)$$$ — it traverses the string only once for each letter of the alphabet

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +11 Vote: I do not like it

      Yes, I understand that but the string is passed by value which is O(N), and also the erase function should give O(N) complexity for every operation.

      Also, you can see that the code takes 1000+ ms for execution, which an N*26 solution won't give.

      The time constraints should be accordingly so these types of solutions don't pass.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Yeah, I guess the compiler optimizes it and the time limit allows it to pass the pretests Not sure whether it will pass systest though

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          It will pass. Two seconds of time allocation for this question is really too much.

          I don't know about compiler optimization, but strings take lesser memory than integer arrays of the same size, so maybe lesser complexity for operations.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Here's the solution for C if you're curious that's the simplest way i think
  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it
    One can also implement it like this. I think this way is easier.
  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Surprised to see multisets works. I thought we must use maps.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      The same complexity finding elements is log(n) erasing element is log(n)

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

If s is a multiset, is if(s.count(x)) $$$O(\log n)$$$ or $$$O(c\log{n})$$$ ($$$c$$$ is count of $$$x$$$ in s)?

I used to think it's $$$O(\log n)$$$ cause the compiler will optimize it. Until today I found this will keep fucking TLE unless I change it to s.find(x) != s.end() or add Ofast optimization manually.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    $$$O(c + log(n))$$$, see complexity section of these docs.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    With the grace of cpp20 now we get a new function known as contains(x), which can be used like s.contains(x), as the name suggests it checks if the data-structure contains the value x or not. The great fact about this is that its just log(n) and plus is more good suiting name

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

For C this was my approach. Can someone explain why this is wrong.

example: 7 1 1 1 3 1 3 3 2 3. Sort the array in descending. 7 3 3 3 3 2 1 1 1 1.

Divide the array in equal sum halves. Meaning this array will be divided into 7 3 3 (sum1 = 13) and 3 3 2 1 1 1 1 (sum2= 12). If abs(sum1 — sum2) <= 1. I will recursively apply this on half1 and half2 until either only one element is left (which return true) or this (abs(sum1 — sum2) <= 1) condition is not met in which case false is returned. if both halves return true then only the answer is yes otherwise no.

My submission: https://codeforces.me/contest/1654/submission/150266681

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It's not quite clear what's going on, but I'm going to guess that given a '1 1 2' you do not know if it combines to 2 2 or to 1 3.

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      it will be combined to 1 1 and 2 because the total sum is 4 and halves will be 2 and 2. My code returns YES in this case btw.


      if (half1 + a[i] <= ((SUM + 1) / 2)) half1 += a[i]; ll half2 = SUM - half1;

      This is how i select the numbers. To be able to select them greedily i sorted the array initially. SUM is the sum of entire array.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        What happens if you have 2 2 1 1 ? You can't divide it to 2 equal sums but this can be achieved 6= 3 3 = 2 1 2 1

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          why tho? My code will separate it into exactly this, 2 1 and 2 1. I ran this test case and my program is return YES.

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
            Rev. 2   Vote: I like it 0 Vote: I do not like it

            But you're sorting the array descending right? if you do then what's the point of sorting if you can separate the halfs without being adjacent

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

https://codeforces.me/contest/1654/submission/150251750

can anyone please tell why this code is getting TLE on test#7, it seems correct to me

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Imagine when you have 200000 numbers each 10^9, and you have to break everything into 1 before returning NO

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I don't think so because i have written the condition if (*s.begin() > x)return; inside recursive function that way it will break much before.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        Have a globally declared flag value, and use it to stop the unnecessary calls if you already got the answer, before solve(a) and solve(b). I also got tle at tc7, but after adding flag got AC.

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it +1 Vote: I do not like it

        As mindFlayer said, you will be making some additional calls to solve. You will be returning from that function call but all the other calls to solve will not end. this works

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Can anyone tell me why this code is getting TLE(on pretest 9) for problem 1654C - Alice and the Cake, I think My code complexity is O(logn*log(sum)) My code

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Complexity is O(2 * sum * logn)

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Solve function goes like that

    Sum + Sum / 2 + Sum / 4 + .... + Sum / Sum = Sum * (1 + 1/2 + 1/4 + ...) = 2 * Sum

»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Why not test problem A first?

»
3 years ago, # |
  Vote: I like it +32 Vote: I do not like it

The questions are nice, but time limits/constraints are not (For problem E).

My solution for problem E runs in $$$O(n\sqrt n)$$$ and I believe it is already the optimal time complexity (correct me if I'm wrong). However, I still had to do like 40 minutes of constant optimisation and get a few penalties for the TLE verdicts.

I have also seen that many other submissions are only just under the time limit, in fact, 1/3 of solutions that passed pretests used more than 4s. There are also around 2.3 times more TLE submissions than AC submissions to add to the fact.

This also caused bottlenecks for other languages, with only 4 languages (C++, D, Java, Rust) having AC solutions on this task.

I believe these kinds of constant optimisation are absolutely unnecessary to competitive programming and does not bring anything extra except benefitting those with templates optimised for constant optimisation, which is irrelevant to one's actual algorithmic skills which competitive programming is supposed to test.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +14 Vote: I do not like it

    For me, $$$O(n \sqrt n)$$$ with unordered_map got TL, but just sorting and solving in $$$O(n \sqrt n \log n)$$$ somehow passes...

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it +11 Vote: I do not like it

    well.. I just failed system tests.. I should have done more constant optimization xD

    upd: my solution got rejudged and got accepted. Is that a new feature?

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +20 Vote: I do not like it

      I think they always rejudge TLE submissions a few times during system tests to avoid subtle differences in runtimes between different executions bringing in a "luck" factor

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    Dear contestant,

    Please don't worry if you had to make some formulas shorter in order to pass a time limit that was set as a triple of our solution's running time. In a programming competition, the way you express your ideas in code actually matters. Apologies if this does not fit your view.

    Thanks for the feedback,

    A mere alt account.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +33 Vote: I do not like it

    I agree with your perspective that requiring constant factor optimization does not make the contest any more interesting. We did not want any solution with correct complexity to get TLE (at least I didn't, I cannot speak for the other preparers). In this case, we made the constraints of E more lenient several times during testing, until the official solution (which uses hashmaps) ran in 1700ms -- at that point we thought the time constraints were reasonable.

    In the majority of cases where contestants complain about problems requiring constant factor optimization, it's not because the authors intentionally wanted to require it, but rather because there was a known brute force solution that could easily pass if the constraints were more lenient, or because changing the constraints would give away the intended complexity, or because increasing the TL would lead to queuing during the round.

    In this case, in hindsight, I would say we perhaps should have lowered the constraint on $$$n$$$, but I'm not 100% sure about it. Such a change would have likely allowed a few highly optimized $$$O(n^2)$$$ solutions to pass, and it's not clear whether that's a "lesser evil" than causing some solutions with poor constant factor to get TLE.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +13 Vote: I do not like it

      This is a good thing for people to learn that sort + two pointers is often faster than map/unordered_map.

»
3 years ago, # |
Rev. 8   Vote: I like it +1 Vote: I do not like it

My approach for C:

-> The sum of array is the starting weight.

-> We can store the count of array elements in a map.

-> We start the simulation using a priority queue, with starting weight inserted in PQ:

->We take the top most element from PQ and check if it exist in the map:(2 possibilities)

  • If it does not exist, it means probably it was divided into 2 pieces later, so we will divide this piece into 2 parts and push them into PQ, to get divided later.

  • If it exists, it means this will be part of the final array, so we will consider that this particular element has been obtained correctly and thus won't be divided further, and we will update the count of this element in map by decreasing by 1;

-> We do this simulation n-1 times.

-> Now, in the ideal case, all the keys in map should have a value 0 as its count.

-> if above statement is true -> return YES; else return NO;

P.S.: Queue would also work fine in this case, as processing the elements in any order will give the same end result. 150248249

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Instead of Priority Queue I was wondering why not normal queue would work. I took some test cases and dry run it, luckily I found that normal queue would work. Anyways thanks for your intuition, it helped me a lot.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve problem D? I have a basic idea but couldn't figure out how to deal with node with n-1 degrees. It would easily overflow.

»
3 years ago, # |
  Vote: I like it +19 Vote: I do not like it

I fell shocked when refreshing the status page and found lots of my friends fst on problem E

panic

»
3 years ago, # |
  Vote: I like it +6 Vote: I do not like it

Me after submitting D in the last 5 seconds with a correct solution but then realized I'm printing the value at the root and not the sum.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

It's a pity that I've only got 15 minutes to participate in the contest :( Luckily, I solved 2 problems within 12 minutes, so this contest is almost unrated for me XD

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Due to AtCoder ABC today?

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Exactly :)

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I registered Rated for ABC but chose CF. I forgot to cancel the registration and got -100 delta in Atcoder...

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

problems A and B were actually pretty easy but then C was very hard compared to A and B

»
3 years ago, # |
  Vote: I like it -15 Vote: I do not like it

I got TLE on problem E in the system test. https://codeforces.me/contest/1654/submission/150264452 After the system test, I resubmit the same code. Then, I can get AC! https://codeforces.me/contest/1654/submission/150275130

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +24 Vote: I do not like it

    This happens to someone every contest. The CF grading servers have some variance in time measurements, and there is nothing we can do about it.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      Thanks. I had a rare experience. I feel the ordinary judge is a little bit faster than in the system test (though I have no evidence).

»
3 years ago, # |
Rev. 4   Vote: I like it +5 Vote: I do not like it

[Deleted] I put the discussion under the editorial blog.

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Why was my first AC submission for C was canceled ?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    If you submit a new solution after passing all the pretests, the earlier ones will be skipped.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone help me explain why this code get tle on test 3 :(( https://codeforces.me/contest/1654/submission/150283548

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    you can limit the times of split operation, the times can't be greater than N.

»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it
»
3 years ago, # |
  Vote: I like it +8 Vote: I do not like it

In problem E, why use 50 as constant can solve the problem but bigger number cannot.

The right constant should be $$$\sqrt n$$$ ,isn't it?

I don't understand why?

My code https://codeforces.me/contest/1654/submission/150288568

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    The pieces in your piecewise algorithm have different constant factors.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I use 100 to pass it...

»
3 years ago, # |
  Vote: I like it +10 Vote: I do not like it

I tried explaining my solutions for problem A,B and C . Link to the video

Hope this can be of any help.

»
3 years ago, # |
  Vote: I like it +9 Vote: I do not like it

The editorial is amazing! I hope all the editorial have "Hints".

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

nice problems.

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Wait!Could you get into the editorial?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I can't, it says "you are not allowed to view the req page"

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Nope, I think they are editing it. It worked yesterday.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone tell me why my code got TLE please :/ It's only O(nlogn)

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    In case answer is "NO" loop can run long before it breaks. If origi.begin() is 1 and x is 1e9 it can create near 2^30 elements for split multiset when the x is invalid.

    Solution
»
3 years ago, # |
  Vote: I like it +35 Vote: I do not like it

Does it seem strange to anyone else that F from this contest is rated 2800 while G is rated 2900? F was solved by 107 competitors in-contest, while G was solved by 10, which intuitively suggests that G is vastly harder than F; Carrot tells me the performance corresponding to 107th place is 2670, while 10th place corresponds to a performance of 3296. It seems to me that F is perhaps slightly overrated, but G is definitely highly underrated. (Admittedly, part of the reason G had so few solves is probably that it appeared late in the problem set, but even so, it's hard for me to imagine that the problem deserves a rating lower than 3100 or 3200.)