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

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

Hi Everyone :)

I would like to invite you to my first Codeforces Round, which I set with my friends JaySharma1048576 and mexomerfCodeforces Round 921 (Div. 1) and Codeforces Round 921 (Div. 2) which will be held on Jan/27/2024 17:45 (Moscow time). This round will be rated for both divisions.

Both divisions will be given 6 problems and 2 hours to solve them.

One of the problems may be interactive. So, you are advised to refer to the guide on interactive problems in case you are not familiar with them.

We would really like to thank:

Good luck, have fun!

Disclaimer

UPD: Scoring Distribution

Div. 1: $$$500 - 1000 - 1500 - 1750 - 2500 - 3000$$$
Div. 2: $$$500 - 1000 - 1250 - 1750 - 2500 - 3000$$$

UPD: Here is the editorial

UPD: Congratulations to the winners

Div. 1:

  1. jiangly
  2. maroonrk
  3. Benq
  4. gamegame
  5. maspy

Div. 2:

  1. kto_eto
  2. fractum_locum
  3. okok
  4. beiyuli
  5. BabaVoss

First solves -

Div. 2:

Problem Participant Time
A jayeshkriplani007 0:01
B Ianlsam 0:02
C rolandpetrean 0:08
D Ignut 0:16
E CoanCoan.com 0:38
F HexShift 1:13

Div. 1:

Problem Participant Time
A Geothermal 0:02
B Benq 0:15
C gisp_zjz 0:13
D Rebelz 0:28
E gyh20 0:32
F Szoboszlai10 1:20
  • Проголосовать: нравится
  • +190
  • Проголосовать: не нравится

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

good luck

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

I've been waiting for this competition for so many days!

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

Oh, it is my turn: 🥹

As a tester, the problemset is delicious and I hope you enjoy.

Also, ahmet23 orz!!!

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

How many problems are there in both divisions?

btw the duration of 2h is pretty nice :)

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

Eagerly waiting for this contest sir!

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

orz sir yash_daga

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

Too delighted and proud sir.

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

Where is the score distribution? Best of luck to all contestants!

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

    Scoring distribution will be released strictly before Saturday, January 27, 2024 at 16:35UTC+2

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

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

GOOD LUCK!!!

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

So why is the registration limit for Div.2 round changed to less than 1900?

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

    It's always been that way in rounds with separated divisions. See for example round 908

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

      tku, maybe I mistook the upper limit for 2100, just like the last round

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

        The upper limit is 2100 in Div 2 (and Edu) rounds without a corresponding Div 1 round. The idea here is that Candidate Masters may find Div 2 A-C boring, so they may as well start from D2D = D1A (or D2C = D1A, depending on the number of shared problems)

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

m

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

ok nice me also from jharkhand :) waiting eagerly

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

Thank you guys for the info, I will try in my home town.

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

Guess Which problem will be Interactive for Div2

1.C 2.D 3.E 4.F

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

orz yash_daga sir!!!

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

Opened CF after months just to upvote this, hail ISM!!!

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

All the three problem setters have solved most problems related to maths and greedy. So, I suspect Mathforces or Greedyforces incoming.

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

right before usaco :c unfortunate

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

its going to be my first contest written by indians and i am very excited for this.

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

I am getting back with coding after a few years with the contest, with a determination to stick to it until I improve this time

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

All the best

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

I Hope to rank up to pupil :DD

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

Good luck!

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

I love the way he writes "You".

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

rp++

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

ORZ%%%

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

Claimer

There may be some pieces of paper harmed during my participation of this round :(

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

This is my first competition i have ever done, I'm not that good, but ill see what I can do lol

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

This is my first contest after eight months away...felt so good back to this cf vibe again!

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

why delayed

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

One refresh costed me 10 mins of time

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

This is becoming a habit now.

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

Delayforces again...

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

Waiting for love :(

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

Did anyone see the questions

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

1 Refresh cost me 10 min.... :)

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

GoodBye 2023 is that u?

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

GLHF

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

seems like it's going to be a hard contest :(

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

why this website is being too heavy to reload in browsers??

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

I could have finished my LoL ranked game, now I lost a star and 10 minutes waiting.

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

    It was your choice to stop playing before you could check if the round is delayed. It's not like the delay was shown 1 minute after the round started.

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

I wasted hours on origami to do 1C.

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

Paperforces

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

Сейчас бы участвовать в раундах от Упирвицкого

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

What is wrong with question C

I dont get why my code is failing ahhhh damnn it !!!

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

WAForce

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

It took me 10 minutes to do Div2D while 75 minutes to do Div2C,i'm really bad at implementation.

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

Was I alone to do so? :D

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

    As a Grandmaster...

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

    I tried folding the paper without drawing any lines, but it ended up being not useful at all since I couldn't tell which creases were mountains / valleys ...

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

    Wish I had a squared paper around me. The pattern was too obvious.

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

      You can get a square paper from a rectangular paper. Just fold a vertex.

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

        yeah, although at times the thickness of the paper from the resulting fold makes it harder to fold even more

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

          Maybe I was unclear.

          • Fold a vertex.
          • You get an isosceles right triangle. Cut the rest.
          • Undo the fold.
          • You get a square with the same thickness as the original rectangle.
»
4 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Was lazy segtree expected on E ? I got tle on pretest 32...243653603

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

    I used ABI and got 823ms. I really hope authors have a good solution, and not this ugly implementation that almost everybody did

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

      My code got ac after submitting in C++ 64 bits :/

      I think they have an "easier" solution that is to store the sum between each pair of harbors and handle manually the harbors on the side but I think it's less convenient

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

    I eventually used 2 lazy segment trees for E but still less than a second man (C++ 17 7.3.0)....

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

div1B is disgusting

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

Thanks for the round! Feedback on the problems:

A: Good problem, appropriate difficulty for its position.

B: Not my favorite problem (unless there's a better solution than just killing it with a segtree / a set?); all the ideas involved felt standard, but because DS was involved it still took a decent chunk of the round to implement. (Also, implementation would have been mildly less annoying if the array X was sorted; I also would have found it easier if the input was passed as (X, V) pairs and not as an array X followed by an array V.)

C: I strongly disliked this problem. It felt basically like a pattern guessing test--maybe some people had the visualization skills to solve the problem rigorously, but I basically guessed a pattern that seemed reasonable, checked that it works for small cases, and then got AC.

D: Realizing that the problem reduces to "find the number of sequences of A balanced bracket sequences with total length B" was pretty nice. The rest of the problem was damaged by the constraints in one of two ways. After thinking of smart ways to count these sequences since the mod suggested FFT was unintended, I ended up just throwing in the KACTL FFT with arbitrary modulus template, which got AC, though running somewhat close to TL (800ms, not slow enough that I was worried about FST but definitely slow enough to TLE FFT templates with bad constant factors).

I don't know whether this solution was intended or not. I suspect not because of the choice of mod, but if this was intended, then I strongly dislike the choice not to use 998244353 as the modulus, and I also don't like the TL (I would have set something like 3s if FFT/NTT was intended).

Assuming this solution was not intended, it's a tougher situation, especially if the intended solution takes O(n^2) memory or O(n^2 log n) time. If one of these is the case, I honestly might have just let FFT pass anyway (and set a more friendly modulus and TL) since I think it'd be really hard to cut FFT cleanly and the first observation is nice enough to justify the existence of the problem. If there was room, though, I would definitely have set n = 5000. As is, I think "FFT works, but you have to use a slightly unconventional template and it runs close to TL" is a very bad state for the problem.

E: Probably my favorite problem of the round (though I'm biased in favor of EV problems). Not hard enough for its position or point valuation imo.

F: Interesting problem, I had no nontrivial ideas. I think the story got in the way of the statement, and you could state the problem more formally in a shorter and more readable way. I think something to the effect of "there exists a hidden integer x from 1 to n, you can query ranges and judge will output 1 if x is in the range and 0 otherwise, judge is guaranteed not to tell the truth or lie three times in a row" would work, without all the flavor text about the students or explicitly enumerating the four cases.

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

    Will You stream solutions? How did you do C?

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

      I don't plan to do a stream. This solution seems likely to TLE, as with x = 1e8 and n = 1, your solution loops through 1e8 values per test case, which will TLE when t = 1000.

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

    Bro Can you explain C

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

      2C: We construct the shortest string T that is not a subsequence of S as follows. Iterate through the characters of S and maintain the list of characters we've seen so far. Once we've seen all k characters, add the last character we reached to T and reset the list of characters we've seen. Once we finish going through S, add any character we haven't seen yet to T. Any shorter string can be found in S (we can find the first character of such a string in S before the first character of T, the second character of the string before the second character of T, and so on); I'll leave it as a (simple) exercise to prove that T cannot be found in S.

      If T has length at most n, add additional characters until it has length n and output it as our answer. Otherwise, no answer exists.

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

        During contest I submitted this just as a pure guesswork, totally no clue why we should add last char from each T. Now after some thinking it's a becoming slightly more evident, but still very vague. Something like if it wasn't the last char that is missing, then it should've finished T earlier.

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

        Thanks for the explanation. Very helpful.

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

    I think D might just be https://en.wikipedia.org/wiki/Catalan%27s_triangle. I just checked some smaller cases and didn't prove though.

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

    Hi, Thanks for the feedback!

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

      Nice, figured there was likely something like that :) In this case, I would have just set n, m up to 1e6, which clearly passes your solution but fails FFT and other such nonsense.

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

        Yeah, it was a trade-off we did to make the solution less guessable. I initially proposed it as div2D but the testers feedback made us feel that it's harder.

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

    the only good thing about D2F/D1C is the fact that you can play with origami paper while solving it :D (still, definitely an annoying problem lol)

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

    The model solution of Div. 1F does require some non-trivial ideas. I will release the detailed editorial shortly but till then, here is one of the ideas that you may have missed.

    Hint

    Thanks for the feedback. From next time, I will try to keep the statement concise.

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

      Thanks for sharing! I'll give it a bit more thought :)

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

    On Div2D I figured out the correct fraction quickly but wasted the second half of the contest on figuring out WHAT IS A FRACTION MODULO 1e9+7. Also on trying __int128 or Python, because the unreduced denominator can reach 10^20 and goes beyond the long long limit. Could you please tell if this is avoidable?

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

      Store all numbers $$$p/q$$$ in the form $$$p \cdot q^{-1}$$$ mod 10^9 + 7. It can be shown that addition, subtraction, multiplication, and division (where $$$a / b$$$ is computed as $$$ab^{-1}$$$) all work normally under this representation of fractions. Since all numbers are less than 10^9 + 7, the arithmetic operations can be performed using long longs.

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

    I googled this explicit formula for the convolution of Catalan numbers: https://mirror.codeforces.com/blog/entry/87585

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

    I have a solution for C, based on capes of paper, once you fold the paper once there are the same number of capes upward and downward(this mean that all steps before that increments both values equally) so you have V=M + 2*sqrt(2). So in every steps the number of capes get multiplied by two, while the perimiter of the square is multiplied by 1/sqrt(2) then you have a geometric progression.

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

Too curious to know where I failed on C. T_T

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

For d1C, was anyone able to reproduce N = 7 irl? The most I could get is N = 4.

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

Was submitting C in last 30 seconds, but Checking if the site connection is secure take a minute

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

Is it the problem setter of d1B in a loss of loved ones that he doesn't even guarantee $$$x_i$$$ is in an ascending order but doesn't even show it in the sample either?

btw, i don't understand what the data range is for for d1D.

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

How the hell to mod a rational number? I've managed to get a working solution for d, getting nominator and denominator, but i still don't have an idea how to convert them into valid answer...

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

    check this

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

      Damn, I shoud've learn this earlier... Thanks.

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

      took me 20min to find the solution exactly there. For those still confused:

      • fraction: 1 / 7
      • numerator: 1
      • denominator: 7
      typedef long long ll;
      const ll mod = 1e9+7;
      ll inv(ll a) {return a <= 1 ? a : mod - (ll)(mod/a) * inv(mod % a) % mod;}
      
      void solve(ll numerator, ll denominator){
          cout << (inv(denominator)%mod * (numerator%mod))%mod << "\n";
      }
      
      • »
        »
        »
        »
        4 месяца назад, # ^ |
          Проголосовать: нравится +3 Проголосовать: не нравится

        For me it took 20 minutes just to read the problem statement.

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

        when p is a prime number, inv(a) can be calculated by a^(p — 2) mod p. (^ means power, not bitwise xor)

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

Div2D was so nice.

For every excursion, our answer increases by (total sum of friendship values)/(# of pairs) on average, and the total sum of friendship values increases by (# of non-zero friendship values)/(# of pairs) on average.

This hand-wavy "average" logic works because of the linearity of expectation.

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

    I find it hard to call problem nice when 60% of input is not even used.

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

      I suppose writers originally had this as a much harder problem, then realize they need something for d2d, so they just go fkk it and repurpose it without removing the now reduntant part

      If you consider the problem without the useless information it's not bad.

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

    Can you please show me your code?

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

mathforces...

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

Anyone thought the position of harbour in div1B/div2E is sorted and keep getting WA at pretest 5?

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

couldn't solve Div2C(Div1A) in 100 minutes

I'm such a brainlet

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

why does binary search not work in B?

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

    it'll work, first stores all the divisors in array , then sort it , now find out that what can be the average difficulty for each sub problem , now we know that our max difficulty won't exceed this average, so use lower_bound on the array of divisors

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

C was definitely one of the problems ever.

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

Too much implementation for a div1 B ...

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

My rating gonna drop due to C. Fuck C

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

C anyone?

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

    I think the point was to check for all intervals of length n if every one of the k letters are in it, if not then the answer is no. Again I'm not sure but if that premise is right you can easily think of a way to construct a string that is not possible.

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

      I thought of that too but there's some flaw in the logic. Take for instance the case when the string's length is greater than n * k. This gives you some 'buffer' characters to play around with, which means that the interval of length n may not necessarily hold all the characters.

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

      1 3 3 11 aabbccabac

      test case where you can fail.

      • »
        »
        »
        »
        4 месяца назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится
        void solve() {
            int n,k,m;
            cin>>n>>k>>m;
            string S;
            cin>>S;
            vector<int> count(k,0);
            map<char,vector<int>> mpp;
            for(int i=0;i<m;i++){
                count[S[i]-'a']++;
                mpp[S[i]].pb(i);
            }
            string ans="";
            for(int itr=0;itr<k;itr++){
                if(count[itr]<n){
                    char ch = itr+'a';
                    for(int i=0;i<n;i++){
                        ans+=ch;
                    }
                    cout<<"NO"<<endl;
                    cout<<ans<<endl;
                    return;
                }
            }
            for(int itr=0;itr<k;itr++){
                char ch = itr+'a';
                vector<int> v = mpp[ch];
                for(int i=n-1;i>=1;i--){
                    int index = v[i-1];
                    int occurence = n-i;
                    string ans="";
                    map<char,int> temp;
                    for(int j=index;j<m;j++){
                        temp[S[j]]++;
                    }
                    for(int p=0;p<k;p++){
                        char check = 'a'+p;
                        if(check==ch){
                            continue;
                        }
                        if(temp[check]<occurence){
                            cout<<"NO"<<endl;
                            for(int hehe=0;hehe<i;hehe++){
                                ans+=ch;
                            }
                            for(int hehe=0;hehe<occurence;hehe++){
                                ans+=check;
                            }
                            cout<<ans<<endl;
                            return;
                        }
                    }
                }
            }
            cout<<"YES"<<endl;
        }
        
        

        Can you tell where does this code fail??

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

    Straight DP:

    Find first position of all k letters. It would base for len = 1.
    Then for each i = 2..n you must have all k letters after all k letters positions for i - 1. If you keep it properly with reverse link, then construct answer should be easy.

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

WTF I didn't submit 1D just because of this 'Just a moment' thing!!!

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

Task C is a very funny task. 10 sheets were damaged

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

I tried to solve problem B using segment tree. But I couldn't do it in integers, because I was required to combine several multiplications; and I couldn't also pass it using floats. How to pass segment tree?

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

    I used Segment Tree and I passed. You store the answer of each position, and operation 1 is range equal to zero and range add an Arithmetic sequence.

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

      Ough, I did other quieries. When I'm adding a harbour $$$p$$$, there are closest to the left harbour $$$l$$$, and closest to the right $$$r$$$. Then I add to segment $$$[x_{l+1}, x_{p-1}]$$$ value $$$-(x_{r}-x_{p})*v_{l}$$$ and multiply to segment $$$[x_{p+1}, x_{r-1}]$$$ value $$$\frac{v_{p}}{v_{l}}$$$

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

    I used lazy segment tree, but instead of multiplying when pushing y just maintained a vector of push's, bit it gave WA on test 8 :(

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

how D?

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

That C..

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

why am i so dumb

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

I felt statement of Div2D to be ambiguous and misunderstood several times. I initially thought once a pair is picked, then its value keep on increasing by one for every next excursion irrespective of what pair is chosen next.

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

    Exactly I wasted a lot of time figuring out the logic for the misunderstood problem, they could have atleast explained a normal test case.

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

I was so close to solving Div2C or at least I hope I was T.T

Edit: nope, not even close

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

too much server problem, but overall good contest and good questions.

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

Hope I will become green this contest.

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

I somehow liked Div1C and Div1E, disliked Div1B, but anyway: Please polish the problem statement before the round (Div1B: "next harbour" concept is strange, Div1D&Div1E: two variables are interchanged, etc.) and please check it carefully for the clarification (I got two wrong responses in this round...).

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

    Sorry about that, will take extra care in future.

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

      Maybe consider sacrificing some pieces of paper in favor of making round even more ideal? :-)

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

I solved 3 problems, I am enjoyed this contest. Thank You

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

i was so exited to participate since this is my first contest lmao , until i spent all the time in the first problem and couldnt solve it lmao , any tips so i can improve ??

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

Can we use binary search to solve Div2 B ? i was trying it at first but i didn't understood where its failing here is my submission 243579415, then i just used linear approach.

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

    I don't think binary search could solve Div2B. Because if K is the answer so every number that smaller than K should be all satisfied. However, if x = 10, n = 2 then all subsets we have are 1-9, 2-8, 3-7, 4-6, 5-5 => gcd of them are 1,2,1,2,5 respectively. So there is no way to split 10 into 2 numbers that have gcd equal to 3 or 4.

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

why CF doesn't let us submit code to check after contest ends :( Just missed submitting E by few seconds and now waiting to see if my solution is correct. Pretty frustrating to wait more.

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

I had fun in this contest. The D reminded me of JEE days. Thank you for fun contest.

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

what is wrong in my solution for question C. My Submission

what I was doing to divide string s into a complete chunk of k alphabets and if someone is missing in last chunk I take this character to form a valid subsequence not present in s.

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

    counter_eg: 2 3 6 aabcbc

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

      Why is it counter to the described idea?

      2 chunks: aabc bc

      a is missing in last one, so ca is final answer.

      I submitted exactly the same idea and it passed pre-tests.

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

        consider 3 chunks and according to your approach, it will give NO, and output "aa" but "aa" is present in the string

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

          I've posted the link to my submission, hack it if you are sure about your counter. To me it seems you misunderstood the proposed idea

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

            You can check the above submission, you will get your answer.

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

Cloudflare for the 87th time today, please I'm not a bot for fuck sake

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

div2B O(n^0.5) with n = 1e8 timed out in python :(

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

What is "orz" btw?, I saw some people saying that?

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

Waiting for tutorial :)

How to know when it will be released?

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

The test cases are very weak for Problem Div2 B. some solution of complexity 1e10 also passed

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

    yes my solution passed with the same problem I'm sure it will TLE now I should have iterated till sqrt(x)

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

Lol, spent last 33 minutes of the round debugging Div.1B, only to understand after the round that coordinates are not guaranteed to be sorted.

In my opinion, such problems problems should contain coordinates already in adequate order.

Div.1B/Div2.D should check participant's ability to invent and implement solution, not ability to carefully read problem statement...

Otherwise, problem is quite nice

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

Weak pretests on B, need n = 1 case

C is the opposite, yet another brutal pretest

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

speed forces yet bricked

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

DM, how to solve C of div 2?

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

sry for the misconception i realised the error but how can i del this comment

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

Welp... i did 1 problem at least. I didnt know that the contest was delayed by 10 mins, so I was confused and thought it was starting on the end time. I ended up starting like 1 hour into the contest, and did problem A at least. A lot learned! Hoping to be at the next competition as well

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

I might be risking losing all my testing privileges here, but I would like to point out that div1A (or div2C), as well as div2A, were pointed out by me during testing to be very close to a certain CSES problem. According to the judgment of the coordinator, "D2A can be not really new," so I kind of assumed they'd be removing the div2C (it was A2 earlier) but not the div2A (which was A1).

My question is — is this expected by contestants? My perception is that it is not, and I feel there should definitely be some more originality in problems that are supposed to be around D2C in difficulty (D2A being unoriginal is probably arguable, so I won't comment on that).

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

Really good contest! Very nice and fun to solve these problems. Thanks for the round JaySharma1048576 mexomerf yash_daga and all testers!

Solution for Div2C (if anyone needs):

-> After solving Div2A, you can see that to get all possible strings of length n using first k characters, the string s should have n groups of the first k characters.

Eg: if n = 5, k = 3 (a, b, c) then s = "abc abc abc abc abc"

-> so in the given string s, traverse from left to right and form such groups of first k characters and find how many such groups you can make (call it cnt)

-> if cnt >= n, ans is YES

-> else, take the last character of each group and combine it with the missing character of the missing group, this newly formed string will definitely not be a subsequence of s, because theres only one such character in each group and we combine it with the missing character.

Eg: if s = "aabbccabab":

the groups are "abc" "cab" "ab"

so taking last character of every group and missing character, we get "cbc" which is the answer

Submission for reference

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

    Hey can you explain the intuition more clearly about this line "because theres only one such character in each group and we combine it with the missing character."

    what I can get from solution is that since we are making blocks as soon as we get first entry of last remaining element that element will always be single. So it is deemed to be remain unique in pattern as opposed to elements who are repeating more than one time.

    also I am thinking that any single element will also be sufficient for concatenating answer but for sake of simplicity we taking last element which automatically will be single because after that we are terminating that block.

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

A: It is easy to find out, that size of our answer is $$$nk$$$ (at least because it must contain all $$$aa...aa$$$, $$$bb...bb$$$, etc). So, we can just break our answer into $$$n$$$ blocks of length $$$k$$$. Each block will contain all first $$$k$$$ letters of the alphabet. So, our answer is $$$"abc...$$$($$$k$$$-th letter) $$$"$$$ repeated $$$n$$$ times. $$$O(nk)$$$ per test.

B: Basically, we need to find such array $$$a$$$, that $$$a_1 + a_2 + ... + a_n = x$$$ and $$$gcd(a_1, a_2, ..., a_n)$$$ is maximum ($$$a_i > 0$$$). If $$$gcd(a_1, a_2, ..., a_n)$$$ is equal to some $$$k$$$, that means, that each $$$a_i$$$ can be represented as $$$k * \frac{a_i}{k}$$$, so our sum will be $$$k * (\frac{a_1}{k} + \frac{a_2}{k} + ... + \frac{a_n}{k}) = x$$$. From here we can see, that $$$k$$$ will be divisor of $$$x$$$, so we can iterate over all divisor of $$$x$$$ (let it be $$$d$$$) and check if $$$\frac{x}{d} \ge n$$$, as we want to make each $$$a_i > 0$$$. $$$O(\sqrt{x})$$$ per test.

C: We can do a greedy approach to find such string, that doesn't occur as a subsequence. The algorithm is basically the same as when we solve "Does string $$$t$$$ occurs in $$$s$$$ as subsequence?", but we want to shift our pointer as further as possible. So, we will pick the furthest first occurrence of some letter starting from our current position, after that we will shift our position to the right of that picked one and remember letter on chosen position. If we didn't lack any letter during $$$k$$$ iterations answer is $$$YES$$$, otherwise we can construct answer as follows: we write remembered letters one by one, after that we add letter, that we lack and until size of our answer $$$< k$$$ we will add letter $$$a$$$ to the end of it. $$$O(nk)$$$ per test.

P.S: Funny, that C is a checker for A.

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

After solving D2A D2B I thought D2D would be easy and got the right answer within O(1), but THIS IS THE FIRST TIME I come across fraction representation like "Calculate p⋅q^−1 mod(10^9+7)" and didn't know how. Also the unreduced denominator can be n^4 which is 10^20 and goes beyond the long long limit. That left me stuck trying python or __int128

:(

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

Problem E basically have the same solution with this atcoder problem ARC114E.

Atcoder

Though it seems this did not affect the standings, as I did not found many others solving this lightning fast. (Not that this particularly affected me as I solved this problem pretty quickly when practicing)

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

    Hi, I thought of the problem after solving the atcoder one and mentioned in the round proposal that my problem is inspired from this one.

    According to me, my solution is very different from the solution of that problem. Only the concept of linearity of expectation is common.

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

      To me, there are two key components of the solutions, aside from linearity of expectation.

      Solution

      With these two key concepts the rest of solution should be basic calculations.

      But by far, the first part is hardest one and take the longest to come up with. Unless the intended solution is very far from what I described then I can see your reasonings.

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

        Yeah my solution is slightly ugly and doesn't use the first concept mentioned by you.

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

div2D was one of the easiest problems I've aeen in a while, and yet i spent four tries, first because i summed without modulo, then because i divided by 2 and not multiplied by 2^-1. i should really get a modulo template

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

    what was your approach for div2 D?

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

      well the base expected value is just sum(f_i)/(n choose 2), and then there is exactly m/(n choose 2) probability to add 1, so in expectation it adds 1 * m/(n choose 2), and that's true for all the stages, and it carries over to the rest. so it's ((k-1) + (k-2) + ... + 1) times that m/(n choose 2).

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

Here is my advice about the problems (Div 2):

A
B
C
D
E

Anyway, kudos to the authors of the round, it was still an overall good contest

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

    Implementation of C felt easy to me, you can check my solution, My logic was to check if i can make n or more continuous substrings of the strings or not with every substring satisfying the condition that it contains all the characters from 'a' to 'a'+ k at least once

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

When I submit solutions after the contest is over ?

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

Why is this giving memory limit exceeded for Div2,C? 243648118

I even tried using map instead of set, yet ntg changed. 243653296

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

    For some reason size of your answer is $$$> n$$$ before last while loop, so it becomes infinite.

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

      Right. The variable cnt when goes beyond n, it goes in infinite loop.

      Thanks for the help.

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

FST on test 24 of B... Please, let me get a huge negative delta then I can farm the next div 3

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

I wanna Duhhhhhh!!!!

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

approach for Div2D ??

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

FST Div2B, fail to solve C, endup solve A only

going to buy rope today

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

for DIV2 C

What should be answer for this?

Spoiler

According to me it should be NO. I thought problem states first k lowercase characters.

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

failing System Tests has got to be one of the worst feelings

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

C ka logic btao bkl iski

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

My submission for div.2b got tle on tc 23. Although I had this feeling that it might get tle still I overlooked as it passed the Pretests.

Atleast they could've provided strong pretests :(

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

WA in test case 3566 in C,any?

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

    consider the following test case:

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

12 fricking FST's in B in my room which were so easliy hackable 😢
Lesson learnt

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

why test cases are not visible now???

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

My submission 243558996 passed pretests but wasn't evaluated in the final submission. Coordinators, please investigate.

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

Thank you for the contest!

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

What is the expected rating of C?

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

so many Div2B solutions failed on system tests

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

Test cases of div-2 B :(

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

Easy and elegant solution for E using only fenwick tree and std::set: https://mirror.codeforces.com/contest/1925/submission/243668425

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

Can anyone tell what is wrong in my submission? https://mirror.codeforces.com/contest/1925/submission/243671686

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

Why this solution doesn't work for Div2C, I've tried to find testcases where it might fail but cant seem to do so. (I know it might TLE I just wanna get the logic right).

https://mirror.codeforces.com/contest/1925/submission/243668507

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

    consider the following test case:

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

can someone please tell about the rating system in contest?? why is it showing increasing alot then expected for ones who locked their problem how does this automatic lock hacks others problem and increase up thier ratings?? how?

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

someone please check my submissions for div2 C , it is showing wrong answer for testcase 1 , and showing accepted test case 1 in next submission even when the output is coming same . Plus the output which is coming on submitting is different from custom invocation .

what is this happening ?

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

I feel soo good

for the first time i solved a question

and this is where my Journey started...

Lets goo :>

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

Finally became pupil

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

As a div.2 participant, I find it very strange, that problem creators decided to leave the link to the wiki page of modular multiplicative inverse in statement of 1925F - Fractal Origami but not for 1925D - Good Trip . I didn't manage to figure out how to restore the answer from rational number, even though i had completely correct solution.

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

What would be the rating of C?

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

My approach for problem C was initially this.



#include <bits/stdc++.h> using namespace std; void generateSubsequences(set<string>& subsequences, string s, string current, int index, int n, int k) { if (current.length() == n) { subsequences.insert(current); return; } if (index == s.length()) { return; } generateSubsequences(subsequences, s, current + s[index], index + 1, n, k); generateSubsequences(subsequences, s, current, index + 1, n, k); } void generateAllSubsequences(set<string>& subsequences, string s, string current, int index, int k) { if (current.length() == k) { subsequences.insert(current); return; } if (index == s.length()) { return; } generateAllSubsequences(subsequences, s, current + s[index], index + 1, k); generateAllSubsequences(subsequences, s, current, index + 1, k); } int main() { int t; cin >> t; while (t--) { int n, k, m; cin >> n >> k >> m; string st; cin >> st; string s = ""; for (int i = 0; i < n * k; i++) { s += 'a' + (i % k); } set<string> subsequences; generateSubsequences(subsequences, s, "", 0, n, k); set<string> orig; generateAllSubsequences(orig, st, "", 0, k); set<string> missingSubsequences; for (const auto& subseq : subsequences) { if (orig.find(subseq) == orig.end()) { missingSubsequences.insert(subseq); break; } } // cout << "Missing subsequences for which the answer is NO:" << endl; if (orig.size() == subsequences.size()) { cout << "YES" << endl; } else { cout << "NO" << endl; for (const auto& missingSubseq : missingSubsequences) { cout << missingSubseq << endl; } } } return 0; } Is this code correct not considering TLE?
»
4 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Div1D one-liner?

Use the usual interpretation of sequences as walks of $$$(+1, +1)$$$ and $$$(+1, -1)$$$. WLOG $$$n \geq m$$$, then the longest subsequence has length $$$(\min y) + m$$$ (minimum y-value plus down arrows count). Using the well-known catalan reflection argument gives a final answer of $$$\binom{n+m}{k} - \binom{n+m}{k-1}$$$, with an edge case at $$$k > \min(m,n)$$$.

243676528

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

Can C be done with DP?

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

I guess people don't like to see what I wrote, and unfortunately I can't delete the comment (no option to do so), Treat this as a DELETED COMMENT.

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

Finally, I could make use of my squared office papers

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

Tilting round :/

A was a good & funny problem. I only got the greedy after thinking through the naive DP over and over and realizing that it can be transformed to greedy.

B, I knew that the problem was basically just this, but it seemed like overkill. Plus, I hadn't actually solved it so I didn't feel like copying somebody else's code. So I over-engineered a terrible set + segtree solution with 5 WA's under my belt B)

C, I literally got the main observation within minutes, and worked out the formula shortly thereafter. Spent 30-40 minutes not being able to implement goddamn complex number arithmetic.

I asked ChatGPT this prompt:

give me a c++ library that supports multiplication, division, addition, and subtraction of numbers represented as a + b*sqrt(2). The underlying type should be a pair of long longs. 

To handle division, we're working over the field 999 999 893 

and it AC'd first try.

For comparison, this was my upsolve: 243684462

and this was ChatGPT's library: 243685245

Lesson of the day? I don't know, massive skill issue :(

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

Any hint or counter test for my div2C??

Here is the submission 243684563

The idea was to split the string in groups where each group has at least one of each first k letters. For example "aabbccbbaaaacb" will split into aabbc-cbba-aaacb. If there is more than or equal to n groups, then ans is yes. Otherwise, no. So in case there are less than n groups, the string could be formed using the last char of each group, and complete the string with the first char wich is not present in the last group. Example: abc-cba-ab => would be c,a,[c]. the last one is c because it is not present in the last group.

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

    Just because a stupid error like:

              // int cte=ans.size();
              for(int i=0;i<n-ans.size();i++){
                   ans.pb(cc);
              }
    

    I needed to use a constant var for ans.size() :'/

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

    Can you look into this submission? 244387004.

    I too had the same exact logic. In the above submission I used a set to keep track of found alphabets.

    Later, I did it with a bool array and a variable for size. 244388047

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

Hi, my problem B during the System test doesn't test again for the main test. After I woke up this morning, I saw my score had been minus but problem B wasn't in the main test. I tried to submit again with that same code and the code seems to be AC (I didn't get hacked or sth). MikeMirzayanov yash_daga Can you help me please?

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

WHERE IS MY B? ⚈₃⚈

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

The pretest of B is weak resulting in many people got hacked and fst.

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

243558075 I solved question A, the pretest passed, and didn't get hacked, but the final settlement showed that only BCD was done, A didn't show "Accept",. I then handed over the same code, which was Accept, why?

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

MikeMirzayanov In the last DIV2 921 my submission for C shows pretests passed , but it neither shows AC nor FST on the final standings . Can you please check once . I solved 3 problems but it shows only 2 problem solved . https://mirror.codeforces.com/contest/1925/submission/243641450

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

PROBLEM B-> DIV 2 void solve() { int a, b; cin >> a >> b; int temp = a / b; int num1 = temp — 1; int num2 = temp + 1; if (a % temp == 0) { cout << temp << endl; } else if (a % num1 == 0) { cout << num1 << endl; } else if (a % num2 == 0) { cout << num2 << endl; } else { cout << 1 << endl; } } why this sol is getting WA on testcase 2 on 94th

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

I've got abrupt rating changes in this round 912 div2. kindly see to this image

yash_daga please solve this issue

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

    I do have same issue, unexpected rating change for my result. Hope this will be fixed.

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

Simple solution for DIV 2D

        int n, m, k;
        cin >> n >> m >> k;
        int a,b,fi,f = 0;
        for(int i = 0; i < m; i++){
            cin >> a >> b >> fi;
            f+=fi;
            f%=mod;
        }
        int num =( n * (n - 1)/2ll) % mod;
        int sum = ((((k * f) % mod * binexp(num, k - 1)) % mod) + (((k * (k - 1))/2ll % mod * binexp(num, k - 2)) % mod * m) % mod) % mod;
        num = binexp(num, k);
        num = binexp(num, mod - 2);
        sum = ((sum * num) % mod);
        cout << sum << endl;
»
4 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Good contest!

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

Anyone using sqrt decomposition to solve div2 problem E? I divide the sequence into $$$\lceil\sqrt n\rceil$$$ blocks, with each block at most $$$\lceil\sqrt n\rceil$$$ length (the last block is cutoff to a lower size). Then for each insertion of harbour, I find its left harbour $$$l$$$ and right harbour $$$r$$$ and then update the blocks in $$$[l,r]$$$; for each query $$$[l,r]$$$, I also retrieve the information in blocks in $$$[l,r]$$$. I think it should cost $$$O(q\sqrt n)$$$ and should get passed. However I got time limit exceeded: https://mirror.codeforces.com/contest/1925/submission/243770890. Could anyone help?

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

c was very enjoyable

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

The Contest was really enjoyable

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

The fact that X was not sorted in B is pure evil. Why would anyone create and approve such a version?

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

can someone tell me in which test case my code is failing?

void solve(){

int n,k,m;
cin>>n>>k>>m;
string s;
cin>>s;
int a[k]={0};
for(int i=0;i<m;i++){
    a[s[i]-'a']++;
}
for(int i=0;i<k;i++){
    if(a[i]<n){
        cout<<"NO"<<endl;
        for(int j=0;j<n;j++){
            cout<<char('a'+i);
        }
        cout<<endl;
        return;
    } 
}
vector<int>b(k,0);
for(int i=0;i<m;i++){

        int c=s[i]-'a';
        b[c]++;
        a[c]--;
        for(int j=0;j<k;j++){
            if(a[j]<(n-b[c])){
                // cout<<j<<" "<<c<<endl;
                cout<<"NO"<<endl;
                for(int idx=0;idx<b[c];idx++){
                    cout<<char('a'+c);
                }
                for(int idx=0;idx<n-b[c];idx++){
                    cout<<char('a'+j);
                }
                cout<<endl;
                return;
            }
        }

}
cout<<"YES"<<endl;
  • »
    »
    4 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I don't really get why I was being downvoted.

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

      because of the way you wrote the code in your comment, the first few lines have a very large font size , and the rest are very small with no ne lines for each statement , it's not readable and it takes up a lot of space.it's a common practice to put your code in a spoiler

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

      And also you can send your code as a link

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

maybe sample of div1F should be t=2 yash_daga

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

Will 1 1 1 b be a valid testcase for Div.2 C?

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

Disclaimer

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

Hey folks, here is the solution video to the problems A to E (Div 2) of the above contest for those of you who'd like to upsolve them or reflect upon alternative techniques to solution etc. The video stresses upon the intuitions to solve the problems mostly from scratch. I believe this will benefit budding CPers who're trying to level up, and it shall inspire them to do better in upcoming contests. I'll try to consistently post videos on some of the upcoming contests and would be excited to see the community grow together! See you all! Feel free to write to me about any doubts/issues/feedback. Thanks!

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

For div2C/div1A, Can anyone please tell why am I getting memory limit exceeded on this submission https://mirror.codeforces.com/contest/1924/submission/244323304