Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. Оно применяется начиная с раунда 972. ×

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

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

Attention! Attention! Attention! Don't miss this opportunity!

Codeforces Round 961 (Div. 2) will be held on Jul/23/2024 17:35 (Moscow time)!

Problems for this round were prepared by a team of Neapolis University Pafos (yes, you've seen its logo in Educational Round announcements) students: Vitaly503, goncharovmike, ikrpprppp.

You will be given 5 problems some of which will be divided into two subtasks and 2 hours to solve them.

Important disclaimer! Some problems of this round were also used in CPFED x JetBrains Training Camp 2024. NUP Contest in Kazakhstan this June. If you've participated in this camp or seen the problems from there, please do not participate in this round.

We would like to thank:

Not-so-important not-so-disclaimer. If you're interested in getting a Bachelor's degree in computer science in the indefinite future, you might want to take a look at Computer Science and Artificial Intelligence program in our university administered by JetBrains.

UPD. Scoring distribution: $$$500 + (1000+500) + 1750 + 2250 + (2500 + 1500)$$$

UPD2. Congratulations to the winners:

Div 2:

  1. rainboy

  2. GidrAcH

  3. toma_ariciu

  4. biximo

  5. zhengjc

Div 1 + Div 2:

  1. tourist

  2. Ormlis

  3. potato167

  4. risujiroh

  5. kotatsugame

UPD3. Editorial.

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

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

Hope I get positive delta ;(

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

As a tester, I wish good luck to participants!

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

As a tester, I will be missing the chance to participate in this amazing contest(( I hope everyone enjoys the problem set.

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

As a tester again, I tested today.

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

As a tester , The problems are worth solving !

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

As a tester, I wish good luck to every participant!

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

hopefully I'll Solve First two problems

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

As a tester, I hope you perform well this round. Good luck!

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

.

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

As a tester, contest is amazing

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

What is the point of using existing problems?

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

    Problems are only used for a specific small group of people who can be considered as testers.Also this contest is not publicly available

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

As a participant, i shall wake up on time

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

As a tester, the problems were really nice 👍

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

cat

»
2 месяца назад, # |
  Проголосовать: нравится +72 Проголосовать: не нравится
Poor kitty got photobombed...
»
2 месяца назад, # |
  Проголосовать: нравится +19 Проголосовать: не нравится

As a tester

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

    Chatgpt solved B1 and I just copied and pasted it. Why do you lie?

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

      well i guess, we found a legendary cheater prompter

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

        Besides that finding such things doesn’t help you and is a waste of time and effort, I also just copied and pasted the problem statement. So, nothing is legendary but a weak and liar tester

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

          I am sorry if that comment offended you(it was just a joke). But if you used ChatGPT during the contest for B1 , i think you are at loss(if not, Awesome!!). Apart from that i wish you good luck on your journey to CM. All the best!!

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

            It’s fine . It’s not important what i did. The important is to put more effort in preparing contests and testing and to come up with original problems in order to avoid problems that generative AIs can simply solve. Thank you and good luck to you too.

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

As a tester, this is my first contest as a tester, I wish luck for participants!

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

As a participant, please give me positive delta!

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

score distribution?

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

As a participant ikrpprppp 's hair is majestic!

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

As a tester, I feel problems are interesting and worth solving. I wish good luck to all the participants.

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

As not a tester, I hope I get +3 delta

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

as not a tester hoping to get color change today

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

Maybe I'll take a step back to take a longer leap in div 3.

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

Very excited for this round!

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

As a tester again, I tested few days ago, hope you find this round interesting:)

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

Hoping to become specialist in this round:)

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

It's interesting to see a cat studying for a CS degree.

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

Какая разбалловка?

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

orz

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

pic goes hard

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

Scoring distribution when??

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

As a tester, I tested the round!

All the best, problem is nice which I solved.

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

As a normal user, i wish i can be CM

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

As an *out of competition participant, I want to AK a Div. 2 round for the first time.

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

scoring distribution when?

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

cute cat

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

What are the score distributions?

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

As a tester, I invited to test after the end of previous round.

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

potato

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

Score distribution??

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

Is cat an official problem setter?

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

Interesting scoring distributuion

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

Indeed it is 5 problems.=)

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

Please give some easy and good questions :)

For Me

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

Doubt solved :) Thanks for the help

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

excited!!

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

Is he a tester?

Screenshot-23-7-2024-19472-codeforces-com

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

Hoping to become Pupil this round. I feel like today is the day.

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

Catforces incoming

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

So will this contest be rated?

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

Subtasks for Div.2 B? Let's see...

»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
`Hope to Get `Purple Color` Back Today!!!`
»
2 месяца назад, # |
  Проголосовать: нравится -24 Проголосовать: не нравится

Worst DIV 2

Sentence is not clear :(

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

I am sorry but the statement of problem D is so badly written.

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

    They could have just said that you need to cut the string into substrings with <=k length instead of all that word bs...

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

      I disagree, transforming the statement is also a part of the problem solving process, however the problem could have been worded much more nicely...

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

Rare occurrence when I lost any remaining will to solve problems in a contest

See you again never

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

bad B2!

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

wth is B2

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

Problem D is just a copycat of this problem: https://acmp.ru/index.asp?main=task&id_task=884

Simply copy pasted my old code and got AC in 10 mins, dislike for testers.

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

In C if $$$a_i$$$ is turned into $$$\text{log}$$$ $$$a_i$$$, it's the same problem as 1883E - Look Back.

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

Please don't FST, please don't FST

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

why even make problem like C?

slowing down use of double for TL really make problem little bit fancy?

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

Questions B2 and C are a hot mess, but I’m crossing my fingers for a positive delta.

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

MathForces

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

These are some beautiful problems <3 I especially loved D and E

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

    Can you please explain D ? ( since there isn't editorial yet. )

    What I tried...

    1. Last letter must be taken.

    2. If there is a letter, that repeats 'k' times consecutively, that letter also MUST BE TAKEN.

    3. Then on the remaining letters, I applied binary search. ( if we can do string split with k letters, then we can surely do with k+1 letters )

    But doing this binary search and bitmasking got me TLE on 8th pretest.

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

Come back to expert soon.

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

Is D somehow using bitsets over dp? Did not get any idea!

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

    Brute force all bitmasks of letters, if I had 1 more minute I would've AC.

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

      Can you please explain

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

        I have yet to verify the veracity of my solution. Let's say you select some subset of letters to be the cases, let's call them "allowed" letters. Now to verify if that selection is valid, we can iterate over the string and if the current character is "allowed", we can just continue, but if it's not "allowed", it's distance to the next allowed letter must be less than $$$k$$$. The time complexity of this is $$$O(2^{c} \cdot n)$$$. This is too slow, so we have to optimize this by precalculation. We can precalculate for each letter in each mask the maximum distance to the next "allowed" letter.

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

          My idea is that each character has a set of masks, each mask represnting some set of characters after the character in some index by distance of k. Now when we brute force some mask we have to make sure that all characters in the mask don't have any mask that doesn't have common bits with the mask. To make sure of that we make dp sos for each character and then we just have to make sure that no sumbask of the complement of the mask is there in this char sorry im just explaining in a bad way

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

        let d[i] = 2^(s[i] — 'A').(index from 1 to n)

        For each subarray whose length is k in d,

        let v = sum or of all elements in that subarray.

        We will have V = {v(1), v(2),..,v(n-k+1)}. (all sum or of each subarray)

        We will try all bitmask of letters. The value mask is satisfied if

        • min(mask & v(1), mask & v(2),.., mask & v(n — k + 1)) > 0

        • mask & d[n] > 0

        So we can use dp sos to find the answer in O(2^n.n)

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

      I have implemented same... but I guess that will give TLE. You can also remove one letter from this bitmask, ( last letter, which must be taken ) . May be the way I implemented could be slow.

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

LOL

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

Nah, man... I don't know how to feel about it. I solved B2 still 6000 in the standing XD.

and C is ####

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

I think B2 has a binary search solution (just turn B1's brute force into binary search)

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

    I solved both using maps. I hope they pass System Tests

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

    272157143 here check my solution does that using simple linear traversal

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

    Yes it has one. Its a little nasty but I like it. Spent one hour during contest on it, but implementation had so many tricky "details" that I kept hacking my code with a half hearted belief instead of giving actual thought to it.

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

only solved 2 and very slow, there goes my rating. Sad

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

IS B1 is of Dynamic programming and if yes how 9k people manage to solve dp question ......leaving garden of green back to concrete layer of grey

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

worst contest last time

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

D was an amazing problem

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

My idea for problem D came from here: 1767E - Algebra Flash. Fortunately, I remembered it just in time

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

found out the bug for c was that i put < instead of <= when there were 5 seconds left of the contest

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

If the contest had 5 more minutes, I might have solved problem D. What a pity!

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

Similar Approach for B2 anyone?

update : Got AC. I was missing an edge case when n = 1. 272176756

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

B2 with 500 pts is just not worthy doing... To many cases make it not beautiful.(in my algo) And C is mostly a Elementary mathematics prob.

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

literally the worst, worst problems I've ever seen

please don't ever make contest again.

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

Can someone please tell difference in fmin() and min() , almost was knocked out by B2 pretest 3

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

Literally finished B2 2 mins after contest is over. Figured out that we only need to look at previous flower only after a long time :(

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

Can someone Please tell me where did I go wrong for problem B1, I am unable to find the case or understand what did i do wrong in my implementation, Thank you

Submission : 272170306

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

can someone please tell me what am I missing? what is wrong with my following submission?

https://codeforces.net/contest/1995/submission/272169593

to problem B1 (https://codeforces.net/contest/1995/problem/B1) I could only pass my pretest 1 and wrong answer after that.

thank you

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

    I couldn't understand your solution completely, but I think you are simply returning the maximum value in the array in case there are no consecutive numbers, this is wrong since this maximum number also has to be <= m. I don't think you are checking for this, even after correcting this mistake your logic might not work since the solution seems to be wrong.

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

I don't like math :(

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

Is there something else in C apart from prev*(log(arr[i-1])/log(arr[i])? gave me a tle

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

Can someone explain the squaring problem?

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

Is C combinatorial? Like counting unique values of difference where an inversions exist then the answer will be m*(m+1)/2?

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

Has anyone tried simulated annealing in E?

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

I read A wrong... Sat there for a while trying to understand it before moving to B1... Turns out I should have started with C... Which was by far much easier to understand. Unfortunately. I sat around and did nothing most of this contest.

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

why wxbqwq is banned

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

    It seems that it's your alt account.

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

    @MikeMirzayanov Don’t think that because you are an administrator, you can slander people, and don’t think that you can’t do it so you can slander others. You have no evidence! ! ! You don't even have a reasonable excuse that one person can only have one account. Codeforces means that the administrator has the highest power. If you think wxbqwq is weak, you can deduct points from him, or even ban his account. However, the eyes of the masses are sharp! ! ! !

    If you ban him, you will let all codeforces users around the world know that Codeforces administrators are corrupt! ! !

    Codeforces will be infamous! ! ! ! !

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

Didn't enjoy this contest at all. Problems B1 and B2 took all my time. It's easy to see that an O(n log n) solution exists but I didn't succeed in implementing it.

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

For problem D.Why my solution written by Python TLE10 ?my code

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

my humble request to problem setters , plz add the definition of diagonal in first problem, take me a long time that we have to consider diagonals in one direction only

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

    well they have mentioned (i+j) thing.

    Although it would be good if we had a figure

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

    but brother, do you think the value of (i+j) is the same in the other types of diagonals? think.

    The definition provided in the problem is perfect.

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

    A diagonal is the set of cells for which the value i + j is the same

    That's literally the definition. I know maybe you mean something like top-right to bottom-left diagonals but if you take a long time to figure out it's one direction only then it's your problem tbh...

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

    I don't think they should be redefining existing terms because there's potential to make it confusing. If you say diagonals consider it both ways else use some other term.

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

B was pretty bad imho. Why did B2 have so less points? It was much harder than B1

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

how to solve D?

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

I have this idea about question D,but I'm not sure about its correctness:

        cin>>n>>c>>k>>s;
	vector<int> a(n+1),lst(19);
	vector<vector<int>> f(c+1,vector<int>(c+1,0));
	for (int i=0;i<n;i++) a[i+1]=s[i]-'A'+1;
	for (int i=1;i<=n;i++)
	{
		for (int j=1;j<=c;j++)
			if (lst[j])
				f[a[i]][j]=max(f[a[i]][j],i-lst[j]);
		lst[a[i]]=i;
	}

The original problem has become a duplicate overwrite problem based on the "ok" array in the code, which we can solve with Dancing Links.

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

any optimizations for this submission , i m getting TLE

submission 272171232

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

Shouldn't B2 have more points than B1?? 500 for B2 and 1000 for B1. It might be very less incentive for people who invested their time in coming up with general solution for B2 than just doing easy way in B1

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

    that means B2 values 1500 points.

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

      But coming up with an efficient algorithm was just 33.33% rewarding while brute force is 66.66% rewarding. I mean, at least 50-50 distribution makes sense.

      Also, the max score of not just one but both B1 and B2 decreases with time while someone is implementing for B2.

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

anyone, how to solve b1 ?

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

    You could use a sliding window. Suppose when the right bound is $$$i$$$ we can choose any left bound within range $$$[j,i]$$$. Then we only need to ensure that

    1. sum of $$$a_j,a_{j+1},\cdots,a_i$$$ is not greater than $$$m$$$;
    2. $$$|a_j-a_i|\leqslant1$$$.

    Also we should maximize the number, therefore just update $$$j$$$ for each $$$i$$$ and choose $$$j$$$ as left bound.

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

After thinking more carefully, I was dumb to resubmit B1 as I thought it was wrong. My rank was downed like 700 after doing that.

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

anyone approach for B2?

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

    You need to check lone flower types and two flower types with petals of form $$$(a, a+1)$$$. Let $$$x = a$$$, $$$y = a + 1$$$ and $$$c_1 = count(x)$$$, $$$c_2 = count(y)$$$.

    Then you need max value of $$$ax + by$$$ such that $$$ax + by \leq m, x \leq c_1, y \leq c_2$$$. With some math, you can do this in $$$O(1)$$$.

    If $$$ac_1 + bc_2 \leq m$$$ then answer is simply $$$ac_1 + bc_2$$$.

    Otherwise, we must subtract as many $$$x$$$ as we can from $$$m$$$. Then in remaining $$$m$$$, subtract as many $$$y$$$ as we can. Now we see if we can convert from $$$x$$$ to $$$y$$$ to get closer to the answer. Since $$$y = x + 1$$$, we need to figure out how much $$$1$$$'s we can add to reach the remaining $$$m$$$.

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

I think the problems are nice!

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

please unrate this round

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

    why?

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

      my solution to problem C which clearly should be executed in O(nlogn) but receive TLE verdict, it must be the case codeforces server experience severe DDOS attack or similar which slowing down my solution during execution lead TLE.

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

        You have a mistake though: if you return -1 mid-array, you still need to read the remaining numbers to go to the next test case.

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

        Always check your code before blame.

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

    please unrate this round

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

please unrate this round

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

Damn. I tried passing the problem C with simple long double arithmetic after going to log(a_i), and it failed (for numerical precision, I guess) on some test. A tiny modification to use log2 log2 a_i right away -- and the solution passes. Oh well :)

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

    Can you explain why this change fixes your code? I did similar idea and just happened to use log2l but why does using logl not work, shouldn't it all be the same since were just using change of base idea, any base should work no?

    Edit: I changed my code to use logl and it worked.

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

    What? I tried log2(log2(a)) and it didn’t work :(

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

      I got WA with log first, then AC with log2. And after contest I tried again with log and EPS, that also worked.

      You can take a look at my submissions.

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

        I got WA with log2(log2(a_i)) in CPP — 17. After Contest I submitted same code in CPP — 20 and It passed.

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

thank you for giving me such a special experience of eating s**t.

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

Thanks to this hack, 272142115 , dozens of cheater failed system test! Even caught an expert cheater NavneetKumar123 =)

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

    How can you say he is a cheater

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

      He failed system test like any other guys who added a non-sense 1<<13 in their codes. So why they added this into their codes? Because they just copy paste the delibrately leaked code without thinking. Even they convert it into other languages using ChatGPT, ChatGPT won't erase the 1<<13:D

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

For problem B, I used sorting + sliding window and from the discussion it seems to be the correct approach but I got WA.

Submission link

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

speedran A B1 and spent the whole contest trying to fix my implementation for B2 just to get 150 points :(

I think it could have had a higher score, considering that it's more difficult than A and B

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

Strange score distribution... B1 shoule be 500 and B2 deserves 1000.

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

My Submission for C (In PyPy) : https://codeforces.net/contest/1995/submission/272154355 It seems to be working fine on first 5 tests but seems to be giving RUN_TIME error on 6th test case (Logic seems fine to me since it passed first 5 test cases)

Can someone help ?

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

    you get "OverflowError: int too large to convert to float" for this test case:

    1
    200000
    1000000 999999 999998 999997 ..... upto 800001
    

    basically your numbers are getting too big

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

    Hello.

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

this was my first contest , I got one question accepted still am unrated how ?? can somebody help

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

best round for me!

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

Very humorous round.

I spend almost 1 hour to solve B2 but failed, then I came to C hoping to solve it. But I got WA on #5 because of precision. I thought that my solution is wrong so I continued work on it to find another solution but failed.

Also, I've heard that some participants discussing about the duplicated problems. So I think this is a very humorous round.

Hope that I won't participate in the round like this and this round will unrated.

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

    Yes I did not like this round either and I only solved A and B1 after submitting WA on C. But this does not justify the round to be unrated sometimes you have to take a hit. And the fact that others realized a problem looks same as some other problem comes to their practice which is also a pivotal factor when it comes to performing well in contests.

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

No Bangladeshi given contest today :(

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

Thanks for the round. I finally became blue. C was kinda cool

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

Guys, pls release the editorial!!

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

Can anyone have a look at this solution for B. Fails test case — 3  

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

    is this one b1 or b2? I can try fixing it if u want

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

      it is for B1 thanks for checking out!

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

        ok, i will do it in 10 minutes when I return home. Hope it's ok for u

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

          I got it bro, thanks though!

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

B2 is a piece of shit!C<<B2

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

eager to see editorials

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

Can someone tell me how to hack a solution?

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

Good div2! This is my first time to solve 4 problems without tutorial! Although 2 was after system testing :)

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

My approach for problem C.

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

    I had the same approach as well :)

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

    I had same solution. I was surprised it passed, because if $$$\frac{\ln a_i}{\ln a_{i+1}} = 2^x$$$ and it gets calculated slightly too large, then it might be rounded up.

    Not sure if there is a hack that can break this solution.

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

      I was curious about this and tried to bruteforce all the combinations of $$$a, b$$$ ($$$1 \le a, b \le 10^6$$$) where $$$\displaystyle \frac{\ln a}{\ln b}$$$ is an integer and ceil(log(a) / log(b)) produces a wrong result. Actually there are some bad cases, but none of them are a power of 2.

      Spoiler

      (Note: I used Python to find these results. Also, in my solution, it's possible to replace $$$\ln$$$ with log with other base, like $$$\log_2$$$, and if you do so, you'll have a different set of bad cases.)

      So I was just lucky that I didn't get caught, and I actually should have subtracted an epsilon before applying the ceil function.

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

    can you find error in my code. I had done the same thing but changed this log2(log(a[i-1])/log(a[i])) with log2(log(a[i-1))-log2(log(a[i])).

    272229285

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

      My guess (without reading your code) is that log2(a) — log2(b) was incorrectly rounded up due to precision.

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

For B1, my code in contest got WA but when i resubmitted the same code after contest, it got AC.
I cannot understand why it is happening and have made a post about it.
Please clear my doubts.
Blog link
Edit -> Understood my mistake, please ignore the above comment

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

can anyone help me please debug why am i getting wrong ans on pretest 4 102nd test case i have provided my code what am i doing is checking for element less than 1 if present and element greater than 1 if present and doing calculations. please help anyone!!! Thank you.

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vect;
typedef map<ll,ll> mo;
typedef unordered_map<ll,ll> um;
typedef vector<pair<ll,ll>> vp;
typedef unordered_map<string,ll> ums;
typedef set<ll> setint;
typedef set<string> setstr;
#define pb push_back
const ll mod=1e9+7;
const ll fact_max=1e6+2;
ll fact_arr[fact_max+1];
ll invfact_arr[fact_max+1];

ll power(ll a,ll b){
    ll res=1;
    while (b>0){
        if (b&1){
            res=((a%mod)*(res%mod))%mod;
            b--;
        }
        else{
            a=((a%mod)*(a%mod))%mod;
            b=b>>1;
        }
    }
    return res;
}
// call to include factorial ans inv_factorial
void fact_store(){
    fact_arr[0]=1;
    for (int i=1;i<=fact_max;i++){
        fact_arr[i]=(fact_arr[i-1]*i)%mod;
    }
}

void invfact_store(){
    for (int i=0;i<=fact_max;i++){
        invfact_arr[i]=power(fact_arr[i],mod-2);
    }
}

ll ncr(ll n,ll r){
    if (r>n){
        return 0LL;
    }else{
        return ((((fact_arr[n]*invfact_arr[r])%mod)*invfact_arr[n-r])%mod);
    }
}

bool compareFirst(const pair<int, int>& a, const pair<int, int>& b) {
    return a.first < b.first;
}

bool comparesecond(const pair<int, int>& a, const pair<int, int>& b) {
    return a.second < b.second;
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	ll t;
	cin>>t;
	while (t--){
	    ll n,m;
	    cin>>n>>m;
	    ll a[n];
	    map<int,int> mp;
	    for (int i=0;i<n;i++){
	        cin>>a[i];
	        mp[a[i]]++;
	    }
	    sort(a,a+n);
	   // for (int i=0;i<n;i++){
	   //     cout<<a[i]<<" ";
	   // }
	   // cout<<endl;
	    set<ll> ans;
	    int i=0;
	    while (i<n){
	       // cout<<"ELE "<<a[i]<<endl; 
	        if (mp.find(a[i]-1)!=mp.end() && (a[i]-1)>0){
	           // cout<<"less ";
	            ll ct1=mp[a[i]-1];
	            ll ct2=mp[a[i]];
	            ll sum=0;
	            if (ct2>=m/a[i]){
	                sum=(m/a[i])*a[i];
	            }else{
	                sum=(a[i]*ct2);
	            }
	            ll rem=m-sum;
	            if (ct1>=rem/(a[i]-1)){
	                if ((rem%a[i]==a[i]-2) && (ct1-(rem/(a[i]-1))>0)){
	                    sum=sum+rem;
	                }else{
	                    ll q=rem/(a[i]-1);
	                    sum=sum+q*(a[i]-1);
	                }
	            }else{
	               sum=sum+(a[i]-1)*ct1; 
	            }
	           // cout<<sum<<endl;
	            ans.insert(sum);
	        }
	        if (mp.find(a[i]+1)!=mp.end() && a[i]+1<=m){
                ll ct1=mp[a[i]];
	            ll ct2=mp[a[i]+1];
	            ll sum=0;
	            if (ct2>=m/(a[i]+1)){
	                sum=(m/(a[i]+1))*(a[i]+1);
	            }else{
	                sum=((a[i]+1)*ct2);
	            }
	            ll rem=m-sum;
	            if (ct1>=rem/(a[i])){
	                if ((rem%(a[i]+1)==a[i]-1) && (ct1-(rem/(a[i]))>0)){
	                    sum=sum+rem;
	                }else{
	                    ll q=rem/(a[i]);
	                    sum=sum+q*(a[i]);
	                }
	            }else{
	               sum=sum+(a[i])*ct1; 
	            }
	           // cout<<sum<<endl;
	            ans.insert(sum);
	        }
	        ll sum=0;
	        ll ct=mp[a[i]];
	        ll num=m/a[i];
	        if (ct>=num){
	            sum=num*a[i];
	        }else{
	            sum=ct*a[i];
	        }
	       // cout<<"A[i] "<<sum<<endl;
	        ans.insert(sum);
	        i++;
	    }
	    auto it=ans.end();
	    it--;
	    cout<<*it<<endl;
	    
	}
	return 0;
}
»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The definition of a diagonal in problem $$$\text{A}$$$ is incorrect.

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

Problem C I solved using dp.

static PrintWriter out = new PrintWriter(System.out); static FastReader s = new FastReader();

public static void main(String[] args) {

    int T = 1;


    T = s.nextInt();


    outer:while (T > 0) {
        T--;

        int n = s.nextInt();
        long arr[]  =s.readArrayLong(n);

        long count = 0;

        for(int i = 0 ; i < n; i++){
            if(arr[i] > 1)count++;

            if(arr[i]==1 && count > 0){
                System.out.println(-1);
                continue outer;
            }
        }


        long ans = 0;

        long dp[] = new long[n];

        for(int i =1; i<n; i++){

            if(arr[i]>=arr[i-1] && arr[i-1] !=1 ){

                long a = arr[i-1];
                long sum = 0;
                while(a < arr[i]){
                    a = a*a;
                    sum = sum+1;
                }
                long b = 0;
                if(a > arr[i])b++;
                if(sum <= dp[i-1]){
                    dp[i] = Math.abs(sum  -dp[i-1])+b;
                    ans = ans+dp[i];
                }


            }else if(arr[i] < arr[i-1]){

                long a = arr[i];
                long sum = 0;
                while(a < arr[i-1]){
                    a = a*a;
                    sum++;
                }

                dp[i] = sum + dp[i-1];
                ans = ans+dp[i];


            }



        }


        System.out.println(ans);




        // end of while loop
    }
}
»
2 месяца назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

rainboy orz

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

Can someone help me with debugging this submission: https://codeforces.net/contest/1995/submission/272209517

The failing testcase is giving correct answer locally.

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

    Check if a[i-1]==1 then 0 operations for a[i] else if a[i-1]!=1 and a[i]=1 then return -1

    Otherwise continue calculating with that formula

    for example see

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

can someone help me why iam getting WA in test 1951 ? mu sub: 272212018

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

SOSdp.....

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

problems were good..

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

why does the below code TLE for D?

int solve(int i,int prev,auto& f,int k){
    if(i>=f.size()) return 0;
    int ans=INT_MAX;
    int l=i,r=i+k-1;
    for(int i=0;i<26;i++){
        if(((prev>>i)&1)){
            if(f[l][i]<=r)
                return solve(f[l][i]+1,prev,f,k);
        }
    }
    for(int i=0;i<26;i++){
        if(((prev>>i)&1)==0 && f[l][i]<=r){
            ans=min(ans,1+solve(f[l][i]+1,prev|(1<<i),f,k));
        } 
    }
    return ans;
}

void helper(){
    int n,c,k;
    cin>>n>>c>>k;
    ignore;
    string s;
    line(s);
    vector<vector<int>> f(n,vector<int>(26,n+10));
    int t=s.back()-'A';
    f[n-1][t]=n-1;
    for(int i=n-2;i>=0;i--){
        f[i]=f[i+1];
        int t=s[i]-'A';
        f[i][t]=i;
    }
    t=s.back()-'A';
    int v=(1<<t);
    cout<<solve(0,v,f,k)+1;
}

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

Seems like B1's tests were too weak against naive quadratic approaches and simple mistakes...

Not only did I hack various $$$\mathcal{O}(n^2)$$$ solutions in 4 different ways (not counting an unordered_map hack), but also this hack was meant to be against TLs but it's just causing so many runtime errors within a short time, even a day after the contest.

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

    I have also noticed that problems B1 and B2 were certainly harder than normally for Div2 rounds. Also, problem C is very specific. Actually, for me problem D looks easier than both B2 and C.

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

the cat look sooo cute

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

Ques 1995B1 was easily solvable with the help of chatgpt's initial suggested code with some minute changes used the same code for solving the problem and its an open source for coders to consult, so it not a violation of rules

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

Hello I have recently attended contest div 2 hosted by you. However this is first time my solution has been flagged for B2. I did not share my code with anyone during the contest, nor did I use any public or shared platforms. My development process was entirely local, and I have always adhered to the contest rules. I have written my code using sublime text editor. I have attached screenshots of my previous approach which i was thinking. I would like to request you to see that approach and the approach that i have submitted you will see a lot of similarity in code and will get to know my thinking process on how i approached the solution

My First approach Part 1 -: https://drive.google.com/file/d/1kdNOj823bkaOoTDYQgNWV0Q9wKVVbJMg/view?usp=sharing

Part 2 -: https://drive.google.com/file/d/1zo6zaNNjXbYbRB7AiIzzbdQLoXevoaUA/view?usp=sharing

My Second Approach https://drive.google.com/file/d/1zjdolNAiufLnNPz7NDy-Y1MPEgQ8ss_f/view?usp=sharing

And then eventually i figure out the way on how to remove x — 1 petal flower cost value to buy more x petal flower and then i posted the solution

My only mistake was to use ChatGpt to rephrase the solution as i used a lot of if/else statement and was running short of time

Please consider my solution

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

I am being accused of cheating for no reason at all in this contest, what happened with problem B is that i had a time limit exceed on my first submission , i tried to ask chatgpt for ideas to make it faster and more optimal to the time limit , and i dont know how and since when chatgpt is considered cheating, what i got as a notification is that i copied someone else solution, but i think what happened is we both used the same tool.

**Solutions and test generators can only use source code completely written by you, with the following two exceptions:

1 — the code was written and published/distributed before the start of the round.

2 — the code is generated using tools that were written and published/distributed before the start of the round.** this is what the rules stated , the tool i used were written and published before the start of the round, i hope if you guys can change the rules if thats considered cheating (using chatgpt), and i hope my solutions get unskipped because i was following the rules and i have no intentions of cheating in comp programming or doing such things.

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

this is the response due to unintentail leakage of my code. here the explaination: The maxPetals function leverages a popular algorithmic technique often seen in competitive programming: the sliding window approach combined with sorting. This method is effective for problems that require finding the longest or largest subarray meeting specific constraints, like maximizing the number of petals without exceeding a given cost. The function sorts the array first, making it easier to manage constraints such as the difference between the largest and smallest values in the current window. By incrementally building and adjusting this subarray, the function ensures it remains valid, a strategy that's both efficient and straightforward.

This approach is familiar to many competitive programmers because it is frequently taught in textbooks, online courses, and tutorials. The sliding window technique is a well-known solution for a variety of optimization problems, and its efficiency makes it a go-to method.

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

Sorry I have use Chat GTP to clear TLE and summited same code. I summited it and many people would have done same so i apologies for this and promises not to do it again.

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

"Hello sir[user:MikeMirzayanov], since nobody is addressing my petition to check on my submmited codes nor answering why i got flagged as a cheater, i will then send this message and hope you can answer me. Sorry for the inconvenients but i am really mad about this situation.

Problem B1;

Since it is the same exact problem without any twists i just used my already AC solution, it is not my fault that the problemsetters did not want to place any kind of twist to the problem nor i care, if the problem was that and i did not copy it from anybody in the contest i am 100% sure that can't be counted as cheating, so please remove the skipped flag since this makes me look like a shady contestant, but i have never cheated in any CF nor any contest in my life... Thanks to the best site ever, CodeForces, From Kiavash

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

Hey, sorry but pls check my submitsion for 1995C - Squaring. I didn't share my code or post it on any websites but I received talk that say my code coincident with khoaa659 :<

btw sorry if bad english