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

Автор SlavicG, 4 месяца назад, По-английски

Happy Holidays Codeforces! 🎅

mesanu, flamestorm and I are very excited to invite you to Codeforces Round 918 (Div. 4)! It starts on Dec/28/2023 17:35 (Moscow time).

The format of the event will be identical to Div. 3 rounds:

  • 5-8 tasks;
  • ICPC rules with a penalty of 10 minutes for an incorrect submission;
  • 12-hour phase of open hacks after the end of the round (hacks do not give additional points)
  • after the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings recalculated
  • by default, only "trusted" participants are shown in the results table (but the rating will be recalculated for all with initial ratings less than 1400 or you are an unrated participant/newcomer).

We urge participants whose rating is 1400+ not to register new accounts for the purpose of narcissism but to take part unofficially. Please do not spoil the contest for the official participants.

Only trusted participants of the fourth division will be included in the official standings table. This is a forced measure for combating unsporting behavior. To qualify as a trusted participant of the fourth division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them),
  • do not have a point of 1400 or higher in the rating.

Regardless of whether you are a trusted participant of the fourth division or not, if your rating is less than 1400 (or you are a newcomer/unrated), then the round will be rated for you.

Special thanks to the VIP testers: AlperenT, KrowSavcik!

Thanks a lot to the testers: Qualified, Kaushal_26, htetgm, MADE_IN_HEAVEN, sandry24, hbarp, Vladosiya, LucaLucaM, Gheal, tvladm, Dominater069, haochenkang, xiaowuc1, pashka, vrintle, BucketPotato!

And many thanks to Vladosiya for translating the statements!

We suggest reading all of the problems and hope you will find them interesting!

🎄 🎄 🎄 Good luck to everyone and enjoy the holidays!!! 🎄 🎄 🎄

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

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

Thank you

»
4 месяца назад, # |
  Проголосовать: нравится +69 Проголосовать: не нравится

very handsome.

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

I promise to solve at least 4 problems.

P.S. Cool photo!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This is my first out of competition and first unrated round

»
4 месяца назад, # |
  Проголосовать: нравится +15 Проголосовать: не нравится

Thank you! Nice photo.

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

Every div 4 is good

»
4 месяца назад, # |
Rev. 2   Проголосовать: нравится -26 Проголосовать: не нравится

Finally, this is my first unrated contest... I hope I will be able to solve all problems under contest time .... Merry Christmas and happy new year to all ....

»
4 месяца назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

I think conducting the div4 contest is the best holidays gift for the people having rating less than 1400.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hope to be a great contest before Christmas...

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

    Christmas was on the 25th, it's the 28th now :)

    (unless you're talking about Orthodox Christmas on the 7th of January :D)

»
4 месяца назад, # |
  Проголосовать: нравится -39 Проголосовать: не нравится

Div4 should be arranged more frequently. Hoping for a great contest!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Are there watermarks on those Christmas hats?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

thank you for this ! I hope my rating will slightly increase. I was demotivated for a long time due to failures after failures

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hopefully with this contest I can enter green :)

»
4 месяца назад, # |
Rev. 3   Проголосовать: нравится -16 Проголосовать: не нравится

I hope to reach pupil after this contest, insha-allah.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

i hope to retain the magic colour even after 10th jan with this round

»
4 месяца назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

so handsome

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

It will be my first Div 4 participation ^_^

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

I would aim to solve >80% problems.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Pupil! Pupil!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The cap on your head looks edited

»
4 месяца назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

As a tester, Santa helped me test the contest

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This will be my second participation at codeforces. Last was Div 3 I couldn't solve a single one.

»
4 месяца назад, # |
  Проголосовать: нравится -14 Проголосовать: не нравится

I think I will be green this year, Insha Allah. Hopefully, this round will be great for me. I wish I could do it.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Wow! Dominater069 was a tester. That's great!

»
4 месяца назад, # |
  Проголосовать: нравится +17 Проголосовать: не нравится

flamestorm face reveal!?!?!!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

div 4 time yay! thank you for the div 4 contest!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I hope I will be pupil after this round

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

As an unemployed tester, I wish all participants happiness and employment.

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

»
4 месяца назад, # |
  Проголосовать: нравится +76 Проголосовать: не нравится

As VIP testers, this was our testing room:

Photo
»
4 месяца назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

i wanna be specialist on this contest :)

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Good luck to everybody ;)

»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Best of luck to all participants!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I wish you all a happy game, and I wish you a good score.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

As a tester, I changed my color.

»
4 месяца назад, # |
  Проголосовать: нравится -12 Проголосовать: не нравится

Hi, can I do red testing for this round? (hehehehe)

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

thank you

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

Eh, 2022-2023 is over, it was not like 2020, which is good, but I remember it as one of the most important years, I hope that next year will be successful for you all

zac-durant-6-Hz-PU9-Hyfg-unsplash-1080x675

I hope that for many every new year will only be better

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

My first Div.4 participation too! As a noob, hope the questions are friendly to me so that I can solve questions that less than 1300 smoothly. good time!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hoping I could reach specialist :D

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Thank you!

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Can't wait to get +ve delta

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Merry Christmas!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The best ending of the 2023 with div4. BTW nive picture!

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

As a specialist, my first unrated contest,unfortunately I can't participate

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

****___After Long Time___****

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Just hoping for +ve delta in this one

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

love it!

»
4 месяца назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

I hope the problems are as easy as it is to spot the fake caps in the picture ;)

»
4 месяца назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

Happy Holidays to everyone and Merry Christmas. Coding in holidays may not be possible for many but Respect to you if you are here

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Thanks for the round!!

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

handsome photo, the last competition in 2023

»
4 месяца назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

Good luck everyone

»
4 месяца назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

This is the day i will say goodbye to my green name

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

do well everyone

»
4 месяца назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

in queue LOL

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

in the statement of Problem D:

mistake: 1<=n<=2*10^5 correction: 2<=n<=2*10^5

»
4 месяца назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

So many people have registered for this round that I had to wait 20 minutes to see the verdict for problem A.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for the round !!!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Loved the problems on this round <3

»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Awesome problems, guys! Keep it up!

»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Nice contest

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is the person replying to the questions during the contest a bot or online human???

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

Fun fact: $$$G$$$ can be solved using GPT $$$4$$$ without any hints.

»
4 месяца назад, # |
  Проголосовать: нравится +32 Проголосовать: не нравится
»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

it's over,

I will never reach cyan 🤡

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Спасибо за раунд, очень понравилась задача G)

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is MO decomposition in F an overkill? :D

My solution: 239387414

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

    might be, solved it using ordered sets, although i believe the author had a simpler solution for F of a Div 4!, btw what was your reasoning behind G?

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

      Basically we clone each vertex $$$n$$$ times. Each clone will be a pair, where first element is number of vertex and second is bicycle we use after we visit this vertex. So, now we just use dijkstra algorithm to find min path to ($$$n$$$, $$$any$$$-$$$bicycle$$$). You just need to find some transitions when you start using different bicycle. Something like this.

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

    You can compress the coordinates, sort the intervals and then use fenwick or segment tree to calculate the answer.

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

    Yeah, it's just nlogn inversion count using merge sort

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

what is the idea of E? i felt its harder than F and evne G ( if i got the idea of G correct)

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

    think about the prefix sums of the odd-index and even-index arrays. What can you say about the prefix sum values at the left and right endpoints of a good subarray?

  • »
    »
    4 месяца назад, # ^ |
    Rev. 2   Проголосовать: нравится +7 Проголосовать: не нравится

    Let $$$\mathrm{sum_{even}}$$$ denote the sum of values on even indices on our current subarray, and define $$$\mathrm{sum_{odd}}$$$ similarly.

    $$$\mathrm{sum_{even}} = \mathrm{sum_{odd}}$$$

    $$$\mathrm{sum_{even}} - \mathrm{sum_{odd}} = 0$$$

    Now, multiply all values on odd indices by $$$-1$$$ in the original array. The condition now becomes

    $$$\mathrm{sum_{even}} - (-1) \cdot \mathrm{sum_{odd}} = 0$$$

    $$$\mathrm{sum_{even}} + \mathrm{sum_{odd}} = 0$$$

    The left side is just the sum of the current subarray. Thus, we need to find a subarray with sum $$$0$$$ $$$\Leftrightarrow$$$ you need to find two equal prefix sums.

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

      got it amazing problem and solution thanks alot !

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

      Still clueless could you explain it to me?

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

        What part of my comment did you not understand?

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

          As to why we need that particular subarray where all the odd incidces sum up to zero and why do we need to use prefix sum here.

          • »
            »
            »
            »
            »
            »
            4 месяца назад, # ^ |
              Проголосовать: нравится +5 Проголосовать: не нравится

            why we need that particular subarray where all the odd incidces sum up to zero

            That's not what I said; odd indices shouldn't sum up to zero. Let me try to explain everything again with more details.

            Let $$$\mathrm{sum_{even}}$$$ denote the sum of values on even indices on our current subarray, and define $$$\mathrm{sum_{odd}}$$$ similarly.

            According to the problem statement, we need to find a subarray such that $$$\mathrm{sum_{even}} = \mathrm{sum_{odd}}$$$

            Subtract $$$\mathrm{sum_{odd}}$$$ from both sides:

            $$$\mathrm{sum_{even}} - \mathrm{sum_{odd}} = \mathrm{sum_{odd}} - \mathrm{sum_{odd}}$$$

            $$$\mathrm{sum_{even}} - \mathrm{sum_{odd}} = 0$$$

            Now, let's multiply all values on odd indices by $$$-1$$$ in the original array. Thus, $$$\mathrm{sum_{odd}}$$$ becomes $$$-\mathrm{sum_{odd}}$$$ in our new array.

            This means that the required condition is now

            $$$\mathrm{sum_{even}} - (-\mathrm{sum_{odd}}) = 0$$$

            $$$\mathrm{sum_{even}} + \mathrm{sum_{odd}} = 0$$$

            For any subarray, $$$\mathrm{sum_{even}} + \mathrm{sum_{odd}}$$$ is just the sum of that subarray. This is because every element in the subarray is either counted in $$$\mathrm{sum_{even}}$$$ or in $$$\mathrm{sum_{odd}}$$$.

            Now, we just need to find a subarray with sum $$$0$$$.

            Let $$$p_i = a_1 + a_2 + \dots + a_i$$$, i.e. the array $$$p = [p_1, p_2,\dots, p_n]$$$ is the prefix sum array of $$$a_1, a_2,\dots, a_n$$$. Remember that this array $$$a$$$ is the one from input, with all values on odd indices multiplied by $$$-1$$$.

            Recall that $$$a_l + a_{l+1} + \dots + a_{r} = p_r - p_{l-1}$$$, i.e. the sum of a subarray of $$$a$$$ can be expressed as a difference of two prefix sums.

            Since we need a subarray with sum $$$0$$$, we need two prefix sums $$$p_r$$$ and $$$p_{l-1}$$$ such that $$$p_r - p_{l-1} = 0$$$

            Add $$$p_{l-1}$$$ on both sides:

            $$$p_r - p_{l-1} + p_{l-1} = p_{l-1}$$$

            $$$p_r = p_{l-1}$$$

            This means that we just need to find two equal values in the prefix sum array. Remember to also include $$$p_0 = 0$$$ in your prefix sum array, since this might be needed when $$$l = 1\ \Leftrightarrow\ l-1 = 0$$$.

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

    a -> pref sum of odd indidces b -> pref sum of even indices for range l...r to be valid ar — al = br — bl -> (ar — br = bl — al) now you know how do it. it's similar to 2 sum problem

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

      implemented the (ar-br) = (al-bl) through n^2 approach but got tle in 3rd TC , didnot get what is two sum problem mentioned in your post can you provide a reference for that i'll go through it O(n^2) approach

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

        hint : a + b = c => a = c — b think of bs. then further how can you optimes it

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

          I'll try to do using this hint.

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

            GL

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

              solved it 239414558, initially I didnot get why 'two sum' in this question , but after knowing the 'subarray sum' problem got to know how two sum can be used to find a subarray of sum equals k, and I also read some post explaining about multilping -1 to alterntive ele. ThankYou for the help alpha1215

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

                glad i could help you btw an advice never use unordered map in contest it can tle

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

                  any other alternative for map in this question, and also i tried solving F in O(n^2) considering a person meets every person whose staring and ending points are inside his starting and ending point, but the soln needs to be optimised

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

                  for first ques you can use simple map it's fine for F yo can sort the people based on their starting position now person i will meet every other person j such i < j < n if the j'th person has ending position less than i'th person after this observation it becomes a classic problem counting the inversions in array to do this there are many the method i know to do this is divide and conquer but during contest i used heap my 239336078

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

    you can solve it with a set , make every even index element negative then loop on the array and insert the prefix sum till i in the set , and find if you have the same prefix already , if true then its a YES .

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

      yeah thanks the implementation isn't a problem but the idea is really amazing i think i need to practice math or maybe need a brain transmission XD

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can someone tell me if my approach for G is correct or not for every node i (min time to reach from 1 to i) + (min time to reach i to n) ans is min of all those nodes;

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

    Trying same thing from hours but don't know why it's not working... I hope some explain flaw in this approach

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

      I think the above approach assumes that the optimal route would involve a direct path from 1 to i and then i to n, and this surely is the case in the first sample test case. However, it may not always be the case as the minimum time route is a walk(not a path always) for the problem.

      Consider the modified weights and bike slowness:

      5 5
      1 2 2
      3 2 1
      2 4 5
      2 5 20
      4 5 100
      10 5 3 1 2
      

      In this case you may observe that the optimum route goes as 1-2-3-2-4-2-5. So, the solution in this case is time(1,3) + time(3,4) + time(4,5). This can be generalized and you can make test cases where the optimum route is a combination of many simple paths, and so the assumption that time(1,n) = min over i{time(1,i) + time(i,n)} fails.

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

        The optimum route is a combination of many simple paths

        Thank you so much for explaining. :)

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Loved the problemset. Solved 6 problems

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

can somebody say why 239395416 getting TLE on 21st testcase?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

What is the time complexity of my code? Isn't it O(nlogn)? 239378769

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can I do F in PYTHON without use SortedList?

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

Could someone please explain how to approach problems like E? TIA

  • »
    »
    4 месяца назад, # ^ |
    Rev. 8   Проголосовать: нравится 0 Проголосовать: не нравится

    We just have to found the subarray (with certain sum x) whose sum of odd and even places is same. what we can do is if we multiply -1(either of the odd or even position) now we just have to find the contiguous subarray with 0 sum that can be done by maintaining a prefix sum and a set(basic hashing)...

    You can take help by this video..

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone explain ideas behind F and G?

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

    For F, you can see that 2 intervals contribute to the answer only if 1 is completely into another. Noy you can compresd all the coordinates, sort the intervals by ascending xleft coordinate and use segment or fenwick tree to calculate the answer. Tou can see my code for more details.

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

      for some reason, I am unable to view your submissions. Could you please share your code, or tell me how to maintain number of intervals between two coordinates l and r using segment tree?

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

    Problem F can be soved using ordered set.239369576

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

      can you explain it

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

      I kept on thinking the entire contest that set can't count elements greater than an element in log(n) time. Didn't know that something like ordered_set exists in cpp. Thank you so much for your elegant solution.

»
4 месяца назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

Gosh these problem setters just made my day. You guys propably don't know how happy you've made me today with this contest. This is hands down the best contest I've ever participated in as newbie. The problems were not too too hard for a noob like me and by no means easy either. i Was able to solve A-C and i know if i had enough time, i would have cracked D (still going to try to crack that bi*ch anyways). B was the my best problem in this contest because it was the thoughest for me and it involved me using something I'm not quite used to(2D arrays). Thanks a lot for such a nice contest.

  • »
    »
    4 месяца назад, # ^ |
      Проголосовать: нравится +4 Проголосовать: не нравится

    Bro really overthinking B

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

      I did not over think it at all. I knew the solution to the problem but what took me time was the implementstion, cause like i stated earlier, I don't really know how to work with 2D arrays, heck i didn't even know you could sort a single row(that's how noobish i am), but I'm glad i learnt alot today, and im happy :)

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

    Tell me one thing, did you copy C? Someone for whom traversing 2D array is tough, had template in C (but not in A and B where it might be useful) which was anyways not required.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

i have used this code to count the no. of inversions i changed it little bit. so i hope this is not considered as cheating and my submissions will not be skipped as many participant may used the same code

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
code

I have no idea why this code is printing an additional character, and it costed me a good contest. Can anyone help me figuring out this?

  • »
    »
    4 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится
        if(i + 3 >= n){
           fin += s[i], fin += s[i + 1], fin += s[i + 2];
    
           cop.push_back(fin);
           i += 2;
           cc++;
           break;
        }
    

    Here, what if i + 2 >= n

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

in problem F why the answer for this input is 9 ?

6
2 6
3 9
4 5
1 8
7 10
-2 100
  • »
    »
    4 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    point(4,5) meet with (3,9) at 2nd sec ->count=1; point(2,6) meet with (4,5) at 3rd sec ->count=2; point(1,8) meet with (4,5) and (2,6) at 3rd,5th sec ->count=4; point (-2,100) meet with every other point at 7th,8th,10th,11th,12thsec ->count=4+5=9;

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

    You must find all $$$a_i > a_j$$$ such that $$$b_i < b_j$$$.

    The $$$(a_i, b_i)$$$ and $$$(a_j, b_j)$$$ pairs that meet this criteria are as follows:

    • 1 8 greets -2 100;
    • 2 6 greets -2 100 and 1 8;
    • 3 9 greets -2 100;
    • 4 5 greets -2 100, 1 8, 2 6 and 3 9;
    • 7 10 greets -2 100.

    So in total there are 9 greetings.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

finally i'm LGM after this round

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can any one tell why my submission to G is giving WA ? Also a clarification i need, if Salvic is at city C and has bought some k bikes till now, then he can use any bike(1 to k) to travel to neighbouring cities of j right ?

My latest submission

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

    He can only use bikes from the cities he has travelled through, i.e. only the bikes from the cities that lie on the path(or walk) from city 1 to city C.

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

      right, then probably I understood problem right though late but still.. like the implementation above covers this fact !

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can someone please explain the test case 1 of problem G? how is 19 achieved?

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

    1 -> 2 -> 3 -> 2 -> 4 -> 5

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

    1 -> 2 time = 10 2 -> 3 time = 10 + 2 3 -> 2 time 10 + 2 + 1 2 -> 4 time = 10 + 2 + 1 + 5 4 -> 5 time = 10 + 2 + 1 + 5 + 1 total time = 19

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

    I'll denote the fastest bike that we currently have by $$$b$$$.

    The steps are as follows:

    • Start in city 1.
    • Buy the bike in city 1, now $$$b = 5$$$.
    • Go to city 2, it takes $$$5 \cdot 2 = 10$$$ minutes.
    • Buy the bike in city 2, now $$$b = 2$$$.
    • Go to city 3, it takes $$$2 \cdot 1 = 2$$$ minutes.
    • Buy the bike in city 3, now $$$b = 1$$$.
    • Go to city 2, it takes $$$1 \cdot 1 = 1$$$ minute.
    • Go to city 4, it takes $$$1 \cdot 5 = 5$$$ minutes.
    • Go to city 5, it takes $$$1 \cdot 1 = 1$$$ minute.

    Elapsed time: $$$10 + 2 + 1 + 5 + 1 = 19$$$.

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

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

u look like kenzo tenma and johan liebert

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hello Everyone What is this trusted participant thing? I see the standings have a trusted participant tag. I participated after long tume. Will this round be unrated for me?

  • »
    »
    4 месяца назад, # ^ |
      Проголосовать: нравится +10 Проголосовать: не нравится
    Regardless of whether you are a trusted participant of the fourth division or not, if your rating is less than 1400 (or you are a newcomer/unrated), then the round will be rated for you.
»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Amazing contest!!! Solved all except E lol. Ordered Multiset FTW in F.
Thanks for the great round SlavicG mesanu flamestorm and all testers.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

my first impression on divs (^O^)/

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

Hoping to become a pupil. Also can anyone explain the test case for F? -10 10 -5 5 -12 12 -13 13 How is it 6?

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

    Everyone greets each other. (-5,5) and (-10,10) meet at 5 (-5,5) and (-12,12) meet at 5 (-5,5) and (-13,13) meet at 5 (-10,10) and (-12,12) meet at 10 (-10,10) and (-13,13) meet at 10 (-12,12) and (-13,13) meet at 12

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

    t = 0. A is at -5, B is at -10, C is at -12, D is at -13.

    t = 10. A is at 5, B is at 0, C is at -2, D is at -3.

    t = 15. B is at 5 and greets A. C is at 3, D is at 2. 1 greeting.

    t = 17. C is at 5 and greets A. B is at 7, D is at 4. 2 greetings.

    t = 18. D is at 5 and greets A. B is at 8, C is at 6. 3 greetings.

    t = 20. B is at 10, C is at 8, D is at 7.

    t = 22. C is at 10 and greets B. D is at 9. 4 greetings.

    t = 23. D is at 10 and greets B. C is at 11. 5 greetings.

    t = 24. C is at 12, D is at 11.

    t = 25. D is at 12 and greets C. 6 greetings.

    t = 26. D is at 13.

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

my face when tourist got hacked ._.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Здравствуйте, я недавно закончил решать Codeforces Round 918 (Div. 4). Завершил три задания из 8 успешно. Как я могу узнать место и посмотреть результаты?? Заранее спасибо

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

What was the idea of F? Segment trees?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Geothermal King of Div4 contests. He ACs the entire problemset so quickly lol.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

stared at G for over 2 hours, ggs

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E ? and someone can give me a countertest for 239242264

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

Not even a clue how to solve E by prefix sum and Why to find a zero prefix sum with the addition of sum being calculated with multiplying by -1 to odd indicies :(

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

    sum_odd(l, r) = sum_even(l, r)

    <=> sum_odd(l, r) — sum_even(l, r) = 0

    or

    <=> sum_even(l, r) — sum_odd(l, r) = 0

    we can either pick sum of odd elements or even elements, and negate it, now it turns into the classical problem of finding out whether a subarray of sum 0 exists

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

handsome!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

why this solution gets time limit on test 3: https://codeforces.com/contest/1915/submission/239385030

isn't time complexity of it O(n*log n)

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E and F? can anyone explain it easily! thanks in advance.

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

Knew about them 30 minutes before the contest and now it's everywhere

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

F is the worst problem I have faced till now, why did these tests allow O(n^2) solutions to squeeze in? I did not expect O(n^2) solutions to pass at all.

»
4 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
int n ; cin >> n ; 
    vector< pair<int,int> > v ;
    for(int i = 0 ; i < n ; i++){
        int a, b ; cin >> a >> b ;
        v.push_back({a,b}) ;
    }
    sort(v.begin(), v.end()) ;
    set<int> s ;
    int ans = 0 ;
    for(int i = 0 ; i < n ; i++){
        auto it = distance(s.upper_bound(v[i].second), s.end() );
        ans += it ;
        s.insert(v[i].second) ;
    }
    cout << ans << endl ;
»
4 месяца назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

lol. tourist's solution of G got hacked.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

div 4 should have more questions..like same number of questions like div2 after D considering as div 2 A

»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

My screencast: https://youtu.be/1cdLQi_0_XQ?si=J7HiLQiXyFT0fe_u finished in 29 mins

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I solved 4 problems and Iam a new comer and this contest is unrated for me. Can I know why?

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

    I am not trying to be rude but can you please read the announcement blog again?

    • 12-hour phase of open hacks after the end of the round (hacks do not give additional points)

    • after the end of the open hacking phase, all solutions will be tested on the updated set of tests, and the ratings recalculated

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can someone try to hack my G solution? https://codeforces.com/contest/1915/submission/239320792
I feel like it should be able to get TLE. I followed an approach similar to bellman ford algorithm. I looped through j and used
dist[1 to i] = min(dist[1 to i], dist[i to j] + s[j]*greedy_dist[i to j])
to relax the nodes like in bellman ford

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

    It seems like the time limit is enough for bellman ford. Try to come up with a case with maximum case and it only takes 2652 ms for your solution to pass.

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

can we solve f without fenwick tree

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone please tell what is wrong in this method for problem G ?

int main(){
    ll tt;cin>>tt;
    while(tt--){
        ll n,m;cin>>n>>m;
        vector<vpll> v(n+1);
        rep(i,m){
            ll x,y,z;cin>>x>>y>>z;
            v[x].pb({y,z});
            v[y].pb({x,z});
        }
        ll a[n+1];
        rep1(i,n)cin>>a[i];
        set<vll>q;
        q.in({0,a[1],1});
        ll inf = 1e14;
        vector<vll>dis(n+1,vll(1001,inf));
        rep1(i,1000)dis[1][i] = 0;
        while(q.size()){
            
            ll d = (*q.begin())[0];
            ll i = (*q.begin())[2];
            ll mn = (*q.begin())[1];
            q.erase(q.begin());
            if(dis[i][mn]<d)continue;
            for(auto it : v[i]){
                ll ch = it.fi;
                ll wt = it.sec;
                ll x = min(mn,a[ch]);
                if(dis[ch][mn]>d+mn*wt ){
                    dis[ch][mn] = d+mn*wt;
                    q.in({dis[ch][mn],x,ch});
                }
            }
        }
        ll ans = inf;
        rep1(i,1000)ans = min(ans,dis[n][i]);
        cout<<ans<<endl;

    }
}

dis[i][j] means minimum distance to reach ith node if the minimum slowness factor is j to reach node i.

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

    because you are initializing that time to reach node $$$1$$$ for every slowness is $$$0$$$, which is wrong, since you can reach back to node $$$1$$$ after taking the slowness of some other node and then procees with that for further $$$optimal$$$ answer but you block it since when it reaches node $$$1$$$ its sees the time to be minimum($$$0$$$) already.

    small test case

    Hope that helps !

»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

everybody talking about tourist hacked problem, but

i got hacked on E for using unordered_map instead of map. it's the first and last time i got hacked for this.

Here a useful blog about that: https://codeforces.com/blog/entry/62393

»
4 месяца назад, # |
  Проголосовать: нравится +18 Проголосовать: не нравится

Idk my solution to G was different from most so...

Solution
»
4 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

maybe i can say win998244353 and ah_shit_here_we_go_again both team worked acc.

They are committed in a completely chaotic order and have different code styles.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

239194376 why is it TL? can some one pls look)

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

I was thinking about this problem F, It's something like count the number of inversions in an array

I solved using ordered_set, binary trie and merge sort(Submission), and I know how to solve using Fenwick tree/Seg Tree.

I wanted to know if there is something easier I can do

  • »
    »
    4 месяца назад, # ^ |
    Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

    If:

    • Walker 1 starts behind walker 2
    • Walker 1 ends in front of walker 2

    Walker 1 will greet walker 2.

    This is true because if walker 1 starts in front of walker 2, it will reach walker 2's end before walker 1, and if walker 1 ends behind walker 2, it will stop before it reaches where walker 2 stopped.

    So we can sort the starting points in ascending order, and then for each walker, we can count how many walkers greet them by counting how many of the walkers we've iterated through so far have an endpoint ahead of our current walker. The order statistic tree facilitates this very cleanly (and at 1/10th the speed). 239357334

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

      It's not too slow, you can use this(Fast IO) to speed up your code

      ios_base::sync_with_stdio(false); cin.tie(NULL);

      I submitted your code again: submission

      It's running in 202ms

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thx

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

why O(nlogn) solution not pass problem F?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hack this, please!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thank you for such fun round!

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

Can anyone please help me understand why 239392696 for problem E is hacked despite O(n)? Even 239438693 raised tl. TT

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

F can use sweep line?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can somebody explain it out why my code is getting error for question "CAN I SQbUARE"

for _ in range(int(input())): n = int(input()) x = list(map(int,input().split())) s = 0 for i in x : s+=i

if(pow(s,0.5)*pow(s,0.5)==s):
    print("YES")
else :
    print("NO")
  • »
    »
    4 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    It's not true that a number is a square number if $$$pow(s, 0.5) * pow(s, 0.5) = s$$$. That is only true if the result of $$$pow(s, 0.5)$$$ was an integer. Since the function returns a floating point number, that floating point number times itself will often be equal to s, so your solution will say "YES" for many non-square numbers.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

can someone tell on which test case my solution of e got hacked

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

    In short, you shouldn't use unordered_map in CodeForces (or other hackable contest), check this.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

In problem E, unordered_map gives TLE, but map gives accepted verdict. Could anyone please let me know why?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

My rating was 772 , and I haven't solve a single problem before in div4. But yesterday I solved two problems. It was supposed to increase my rating. But my rating remains the same. Why ? Can anyone explain please.Why this contest was unrated for me (:

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I have created account this account year before and I had given the first contest today. This was unrated for me and my contest rating is also showing as unrated. I solved four questions in this round. Can I know the rules of rating and why Iam not rated?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

In 1915F - Greetings,

I don't know why the First code get TLE, but the Second code passes. I'm not sure about the reason. Can you explain?

First java code : 239385944 — using Treeset, headtail method

Second java code : 239456229 — using ArrayList, BinarySearch method

Is there a significant difference in the time complexity between the two codes?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

It's my first Div 4 participation

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why my rating has not increased after giving codeforces round 918 contest. I registered for it an hour before but it is showing unrated. My rating is below 1000

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Have the tasks been retested yet?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I'm actually a bit confused regarding this round, as my rating is below 1400 and yet after solving 2 questions, my rating hasn't been increased. If anyone could please help me explain the situation please.

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

Can anyone explain why me solution got AC? it has a time complexity of n^3 https://codeforces.com/contest/1915/submission/239328701

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why haven't our profile ratings changed ? My rating is 870. It should've boosted or decremented my rating

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Will there be system testing for this round?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is this contest Unrated?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Where can I find the editorial? or is it unavailable

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

thank you!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

One person has been abusing me by sending messages because I hacked his/her solution in this contest. Is there a way to report that person?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

For anyone who wants to know more about similar problems like G.

Here is a great blog on shortest path modelling:

https://codeforces.com/blog/entry/45897

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Editorial when?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

When will the rating get released?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I solved 5 out of 7 problems and they were accepted. Now it shows only 2 out of 7 were submitted ? What the hell. I just checked 3 hours ago it showed 5 out of 7 were accepted

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is it possible for a solution to be rejected due to TLE during system testing even if the submission was earlier accepted during the contest ?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

During the contest I solved 4 questions but now it is showing that I solved only two questions somebody kindly help

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I would like to ask why this submission receives a WA in the new testcases (C) https://codeforces.com/contest/1915/submission/239236542

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

    You are typecasting to double, so it is possible that some value which is not perfect square can also match(due to precision issues). You had to typecast to long long. If it was a perfect square, then only it will match

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

thank you!!

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Bro rip lmao A-E was easily doable in an hour. Failed E because of using unordered_map and in C forgot to use long long once.

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

Hey SlavicG, I think there was something wrong for me, my rating is less than 1400 and this contest should be rated for me, but it shows that it isn't the case, it also shows that in my profile. How can I solve that?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is there anyone else who gave this round for the first time(unrated before this) and even after 24hours your account is still showing unrated??????

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Will i be rated if i have given contest first time and solved 4 problem in this div4 round??

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

is this contest unrated ?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

it was a nice contest for me.... happy coding for everyone

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why was this unrated for me? I've never been >1400 so I'm really confused

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

What is the problem with the unordered_map? I used the same solution just a little change using map instead of unordered_map got AC on problem E.

Why is this happening?

TLE submission:

AC submission:

UPD: Found solution on this

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I participated in the contests and solve few problems while I'm newbie then why didn't I recived any points yet

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I have submitted the contest on time but havent been rated for it yet, how much time does it take usually?

It's my first division 4 contest and I'm quite new to the platform..someone please guide me

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I don't know why my rating is not updated. Can anybody help?

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thank you!

»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

In Question E

Why unordered_map has given TLE in test case 16

But ,using normal ,it gets accepted,Although we are using only find function of map

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

    because worst case of find in unordered_map is O(n)

    but in map is O(log n)

    so in some case, it will TLE.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

FINALLY

I am a specialist NOW

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Could someone please help me find the editorial? Or perhaps lead me to the solutions of E, F and G questions? I tried to implement the solution of vgtcross given in the comments under but I am not sure where I have messed up. Here is the submission. 239587509

  • »
    »
    4 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится
    • The editorial is here. You can find it by going to the contest dashboard (problem list); on the bottom right, there is contest materials -> tutorial.
    • About your solution to E, it seems like you were able to get it working. About the use of unordered_map, you should probably read this (unless you did already).
»
4 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I solved two questions in the contest and both were correct then why did i get an overall negative 28 and a penalty of 54

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

.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I became Specialist...

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Hello! This is my first ever comment on CF. I have a question regarding prob F. I have 2 codes: one uses a vector to store left boundary of interval & one uses a set. The one using a vector is getting accepted, but the one with the set is giving TLE. Does anyone know why is that? Here are the links of the 2 submissions.

https://codeforces.com/contest/1915/submission/240288584 https://codeforces.com/contest/1915/submission/240288739

Thank you in advance :)

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

    https://codeforces.com/blog/entry/45902

    distance() is O(n) -> complexity being O(n^2) when using set

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

      Thank you so much. But isn't inserting in a set 0(logn) & inserting in a vector 0(n)? Doesn't that make up for the difference? ie In a set : insert log n and distance n. In a vector: insert n and upperbound logn

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

        tf sorcerery is this

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

          Inserting in a vector is O(n) too. So how does this submission get accepted? Isn't it O(n^2) also? If you figure it out please lmk.

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

            I'm really not sure why this is working. Possibly because vectors use the hardware much better than sets — was reading this — https://stackoverflow.com/questions/20960936/fastest-insert-c?rq=3

            either ways, the solution with vector is theoretically worse time complexity and definitely O(n^2).

            You should use a self balancing binary tree such as red black tree when doing this problem (like using ordered set from gnu pbds package) instead of vector. eg my submission — https://codeforces.com/contest/1915/submission/239449554

            i think possibly the time limit on this problem being 5 seconds is a lot and should be 2 seconds. But honestly im impressed this even runs till the end without timing out. freaky stuff.

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

              Thank you soo much! Just another note: if you observe the running time of the code using vector, the time is almost reduced by half something which I cannot find an explanation for.

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

although i could not take part in it on time,but after i vp,i feel good?happy everyone

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Плохой раунд

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

All my attempts were ignored due to the fact that my code for task E in logic coincides with others. I didn't post or take the code anywhere. Due to the fact that we are solving 1 problem, the logic of the code may also be the same. Please can you fix this![user:System]

»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I really want to author some problems for Div.4 it really improves my skills Hope to contribute in coming Div.4 Rounds mesanu , SlavicG , flamestorm , MikeMirzayanov

I have an ideas for it .