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

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

Good Day Codeforces!

Me and Tsovak are happy to invite you to take part in Codeforces Round 972 (Div. 2), which starts on Sep/14/2024 17:35 (Moscow time). You will be given 5 problems and 2 hours to solve them. Two problems are divided into two subtasks.

The round will be rated for all participants with a rating lower than 2100.

The problems were authored by me with Tsovak's help to solve and alter them.

We would like to thank:

Score Distribution: 750 — (500 — 500) — 1500 — 2250 — (1500 — 2000)

UPD1: The Editorial is out.

UPD2: Congrats to the winners!

Div.2:

  1. SSKMF

  2. kkkksc03

  3. achen.80

  4. cqbztl

  5. untra_robot

Div.1 + Div.2:

  1. jiangly

  2. aryanc403

  3. Ormlis

  4. maspy

  5. kotatsugame

On the left, you see Tsovak with TheScrasse at IOI 2024.

On the right, you see me with Tsovak at IOI 2024 (I Owe Ice Cream 2024).

1

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

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

As a tester, I

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

As a colorblind tester, what color is your Accepted?

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

As a tester tested long before, I should recall the problems to my memory.

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

As a tester, I toasted the round.

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

Does this mean C will be super harder compared to B2 ? C ~ E1 ???

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

Finally a contest after a long time .

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

after ages...

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

As a tester, I tried to get accepted with some shitty solutions.

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

nutella testing is crazy!

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

As a tester,I recommend you to read all problems

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

As a contestant, BiNARyBeastt and Tsovak orz.

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

This is the first and last div 2 round in September... Looking for more!

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

After a long time...

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

This one will be cool :D

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

Who is Tourist tester?????

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

"for wonderful double coordination and chess skills" back story?

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

    I wish I had something cool and interesting to say, like we fixed a problem using our chess skills, but I don't, lol. Scrasse was just playing in a chess tournament during testing, and I used to be a professional chess player, so I found it interesting and asked him to play some games with me.

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

As an IOIer, it's sad that I didn't know TheScrasse was in IOI

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

Oh, subtask in problem B! It must be interesting!

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

For tourist: You for participating!!

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

I was stalking the writer of this round, BiNARyBeastt. I found out that he has skipped submissions in two of the past two contests.

  1. https://mirror.codeforces.com/submissions/BiNARyBeastt/contest/1616
  2. https://mirror.codeforces.com/submissions/BiNARyBeastt/contest/1713

Does he cheated in these rounds $$$??$$$
»
20 месяцев назад, скрыть # |
Rev. 2  
Проголосовать: нравится +10 Проголосовать: не нравится

the "You" written in Legendary Grandmaster Style. When it will be true...

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

Remove or ban this person who posts adult photos because school Children less than 18 years of age are also practicing on this site.

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

I think problem A will be harder then B1 and B2

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

crazy speedforces it is

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

Great to see no more sex images!

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

As a tester, I can guarantee that you'll enjoy this round, ceteris paribus.

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

First time for me. I just started CP does it make sense to participate?

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

As a tester, I have many questions (perhaps about how to deal with the AI situation). Probably too many.

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

A contest after so00 long but clashing with leetcode biweekly

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

The score distribution of this contest is really unique!

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

can anybody explain what is sub task?

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

this round going to be wild, new version of GPT available for first time in rated round in CF

to see how serious current situation is
»
20 месяцев назад, скрыть # |
 
Проголосовать: нравится +24 Проголосовать: не нравится

Is it rated????

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

Why am I unable to register as unrated participant?

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

wish to cross 1800 rating today

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

"I Owe Ice Cream 2024", It's cute.

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

Link

Sharabi Lal is cheating alongside 100 live cheaters

Username: kya_b120

Please take action

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

Why is B so confusing? If a teacher is at cell 1 and David is at cell 2, then the teacher moves to cell 2 and David moves to cell 1, does that count as getting caught?

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

Yup just thinking about some parts of C and E1 solutions without any close full idea. just gonna eat popcorn and watch my rank go down.

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

cout.tie(NULL);????????????????

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

I'm not going to use ceil() function in my life ever again.

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

dp forces

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

one of the Worst A in cf history.. could be the worst(est)

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

    It worths 750 points, so it is expected to be harder than normal

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

      what is the solution for A?

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

        First, notice that you can avoid making palindromes by greedily making the string as "aeiou" repeating (Which is "aeiouaeiouaeiou...").

        But in this problem, a palindrome can be formed by a subsequence, so there are also palindromes that can be formed by characters that are in between 2 similar characters, like "aea", "aia", "aoa".

        So the second thing to notice is you can move all letters 'a' next to each other, then all letters 'e' next to each other, and so on. Now just print the string in this order and it is the correct answer. (Obviously you can't avoid the palindromes that are of the form "aa", "ee", "ii" so this is the optimal answer).

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

        first observe that if we place similar letters apart then, we would be increasing the number of palindromic sub-sequences. Hence, we should present similar characters together, also observe that we should have many different characters as possible with lower frequency. So, at first distribute the powers using n/5 to each, then remaining would be n%5 which would be given only to the characters with i<(n%5).

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

      got 5 WA for me it still 400

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

is C standard problem? how to be good at problem like C, I've been staring problem C for 90mins and still have 0 clue 😥

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

    You can begin to understand this problem by observing what the answer for the case with N-1 strings means for the case with N strings. Problems like such generally are solved using DP. Try to understand what concatenating a new string to the end means for the final answer.

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

Problem C is dp, right?

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

B ruins my mood for other problems (I sorted the teachers' position BEFORE accepting the input)

cooked

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

Oh my god C took 100% of my brainpower, just logged off after solving it

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

why did u steal David's homework-?! sobs

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

Again this happend

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

Anybody got tips or good problems to help train for math questions like B?

»
20 месяцев назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится
My prob C history

:joy: problem C was a lot of fun

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

Yep, should've just attended the Leetcode round today.

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

Can someone tell me what is wrong with my C submission?

The idea is that each string has "type", which is the ending it can be completed to. So na = type 1, naaare = type 4 etc.

Then I use DP[i][j] = the best composite string you can get of type j, using the first i strings.

In each DP[i][j], I store the string itself. But because those strings can get quite long, I remove the "used up" characters, and keep track of the "total score" of that string, and the "hidden score" of that string.

https://mirror.codeforces.com/contest/2005/submission/281250930

I really feel like this should make sense, but for some reason my code get WA on testcase 2.

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

For problem B, Am I the only idiot who took that b1<=bi<=bn would satisfy throughout. Apparently it doesn't satisfy this condition. I solved b1 in 13 minutes, but due to this dumb error, I made 6 wrong submissions before finally figuring it out

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

DP in C was harder than the DP in E1 for me

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

what to do in A and C . Plz expalin senior coders

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

(sorry my English is poor.) I have a question: if I submit once before, and past the pretests, and I submit a new code later, as the rule says, I will get -50 scores, but when I viewed the standing during the contest, my score of E1 changed from 944->802, and my rank fell nearly 100rks. Is this normal?

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

Beautiful problems! I expecially loved C and E1. As and OI-style enthusiast I loved the subtasks :)

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

note that if Narek fails to complete the last occurrence by finding all of the $$$5$$$ letters, then all of the letters he used are counted in ChatGPT's score $$$score_c$$$, and Narek doesn't get any points if he doesn't finish finding all the 5 letters.

Even with this reminder in the statement of problem C, I still forgot to handle this case ;)

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

(Maybe)Worked out E2 after contest 3 minutes, and lost 900 pts.=(

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

What wrong in my recursive dp solution for C 281249632

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

AryanDLuffy likely cheated using GPT for this contest, look at his submissions and compare to previous contests. His template and coding style completely changed. Also he solved E1 in 8 minutes while writing like 50 lines of comments that a human would never do and somehow failed B2 at the same time.

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

misunderstanding of problem C makes my contest to be interrupted, feeling sad.

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

Crazy contest. I solved A, B1, B2 and somehow still got expert performance.

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

Can someone please help me understand why I got TLE on B2 on this submission?

https://mirror.codeforces.com/contest/2005/submission/281216208

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

    Since your v is a set, you must use v.upper_bound (Not upper_bound(v.begin()...)) to achieve logarithmic time complexity

    For why upper_bound(v.begin()...) isn't logarithmic in this case, you can refer to this link (On non-random-access iterators, the iterator advances produce themselves an additional linear complexity in N on average.)

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

Why did my E2 solution get TLE on TC24? My solution complexity is O(n * (m + l) * log(n * m)). Is std::map too slow or do constraints of the test cases and statement contradict?

My submission: 281237867

I would be delighted if somebody helped with my problem.

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

In problem B I thought teachers and David moves at the same time, and was solving this version of problem), and it was quite annoying version of the problem)

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

    but they do move at the same time right? if n = 5 and teachers are at 1 and 2 and david in 3 then david will move to 4 and teacher at 2 will move to 3 at the same time making the ans 5 -2 = 3 right?

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

      No, Statement says David moves first, and only after David moved Teachers will move.

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

        Yeah but does that make any difference? I mean they are at distinct cells in the first place..so whether david makes the first move or they make the move together the scenrio is same cuz at one point teacher and david will take position side by side and david cant move and the teacher will make a move and catch him

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

          it makes very big difference.

          consider the case:

          teachers positions = [2, 100000]

          David's position = 1

          and if teachers and David moves at the same time:

          • if Teacher 1 moves to position 1, then David moves to position 2
          • if Teacher 1 stays at the position 2, then David stays in position 1

          so we will have to wait for second teacher in position 100000, to help us. So it's very important to know for teacher if either David moved or stayed, and u can't know that if they move at the same time.

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

            David will move first, and upon that move, the teachers will move optimally to catch him

            so, with your test case, if David moved (to the only cell he can move to, the cell 2), the teacher in the cell 2 will stay in that cell and catch David

            and if David didn't move, then the teacher in the cell 2 will move to cell 1 and catch him

            and as mentioned in the problem: Everyone sees others' moves, so they all act optimally.

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

              Yes, I know it. I just explained other version of problem, and why it makes difference.

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

                If they move the way you interpreted tbe question i.e. moving at the same time then they can never catch him cuz if they land on david cell david will move to their cell and if they dont move david will also not move so it will be impossible to catch him in that scenerio but yeah i get your point

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

                  it's pretty possible in all cases where we have at least 2 teachers, and we really do have at least 2 teachers in this problem.

                  the tactic is simple, u just will make 2 teachers adjacent pos = [i, i + 1], and will move towards David with this two.

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

I think that this time the problems are so hard

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

I sincerely hope to enhance CF pretest.(like C)

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

I hate dp very much

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

Why does this exceed the time limit for C https://mirror.codeforces.com/contest/2005/submission/281250159

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

dp contest(C,D,E1)

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

new version of GPT now capable of solving div2E, it's over, seriously.

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

This was a really fun contest!

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

Thanks for the contest!

Problem A was fun as a first problem. Great job!

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

Such a nice contest!

  1. I did not notice any lags (thanks Mike!). Like, no lags at all. I have not seen this level of stability in any contest ever
  2. Some problems are split in two parts. I think this problem-splitting approach should be continued in future Div. 2 contests to make newbies (like myself) lives more comfortable
  3. All of the problems that I looked at (A, B, E1) are incredible. What I especially like about them is that they do not reveal any tactics in the examples

HUGE thanks to everyone who made this contest possible! This is the best contest in my life.

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

After a long wait a specific country is back with all it's telegram channels..

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

I'm not allowed to see the Editorial !?

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

Reading wrong constraints in problem C and wasting 45 minutes thinking how to solve 🥲

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

A bit low-quality

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

I finally got CM!

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

did you consider whom submission was hacked after the system test?

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

Noone tourist-tested it?

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

congratulations aryanc403

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

Why does a submission of dp memoization gives TLE on C ? but when i simply tabulated it, it got accepted. as far as i could interpret, the TC for memoized solution would be O(10^3 * 10^3 * 5) + O(2 * 10^3). am i wrong here? MY SUBMISSION : 281229405 it contains both memoized rec function and tabulated solution.

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

    You initialized dp array with -1. And it is possible for some state the optimal answer is -1. So here it is recalculating its value again. Initialize your dp array with something else like INT_MIN, it will work.

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

Can anyone please help me understand why my Java 21 code is getting TLE for problem B? (I tried storing teachers' position in a TreeSet, as storing them in ArrayList and then sorting it was still giving TLE):

import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt(), n, m, q, curQ, ans;
        Integer l, r;
        TreeSet<Integer> tSet = new TreeSet<>();

        while (t-- > 0) {
            n = scanner.nextInt();
            m = scanner.nextInt();
            q = scanner.nextInt();

            // Taking teachers position in sorted fashion (works because each position should be unique)
            for (int i = 0; i < m; i++) {
                tSet.add(scanner.nextInt());
            }

            // Running queries
            for (int i = 0; i < q; i++) {
                curQ = scanner.nextInt();

                // Finding lower bound and upper bound teacher positions for current query
                l = tSet.floor(curQ);
                r = tSet.ceiling(curQ);
                if (l != null && r != null) { // Case: between  teachers
                    ans = (r - l) / 2;
                } else if (l != null) { // Case: Only 1 teacher on the left
                    ans = n - tSet.last();
                } else { // Case: Only 1 teacher on the right
                    ans = tSet.first() - 1;
                }

                System.out.println(ans);
            }

            tSet.clear();
        }
    }
}
  • »
    »
    19 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Looks fine to me... is Java too slow? Try Java 8 instead?

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

      Sorry for the late reply. It worked with Java 8 as you had suggested! Does this mean we should avoid using latest JDK for competitions, and stick to Java 8? Why is Java 21 slower than Java 8? Thanks again for your help!

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

        I wasn't sure. Your algorithm looked fine, and I guessed java 8 maybe faster or slower than java 21, so maybe worth a try.

        newer versions maybe faster because it includes more optimizations, or it maybe slower because it has more features. so it was really just guessing from my side.

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

Question on B2:

I was expecting a Runtime Error for 281319760 because b[-1] and b[m] are called in some instances but it went through as AC.

However, this 281170767 got a RTE that I was not expecting.

Also, I thought 281319760 and 281318600 have the same time complexity but I got a TLE for the latter.

Could someone please explain, thanks.

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

For problem C, my python submission aligned with the given constraints, but failed because of TLE on test 17. By the way, after the contest, I submitted the exact similar code in C++, and it got accepted.

After the contest, I noticed that every python submission for problem C failed because of TLE on test 17 or test 19.

I personally believe given time constraints aren't enough for Python, and that there's no solution in Python that could get accepted. Isn't it the organizers' responsibility to make sure that this situation doesn't arise?

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

Can anyone please explain me why is my code giving TLE on problem C. Lazy Narek. It is O(N*M) implementation only. Link: https://mirror.codeforces.com/contest/2005/submission/281438234 Thank You!

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

MikeMirzayanov In this round, I got a message that my solution for C coincides with Tashrif2001 which is THIS and with that of puneet_73 which is THIS.

For the coincidence with Tashrif, I do think the solution idea might be similar but the implementations of me and him are radically different. The only thing that might have confused the algorithm here is using similar variable names which are pretty standard variable names. Even if I assume we were connected in some way and changed our code structures then it doesn't really seem plausible to keep the same variable names. So in this case, having similar variable names suggest more of originality than cheating because a cheater who would change the implementation structure wouldn't keep the variable names same.

For the case of Puneet, I do see a similarity on both the idea and implementation. I do want to bring it to your notice that my submission was done before him and if he copied my solution it might be the case that he could have gotten access to it via someone who hacked mine. Here is a screenshot of my conversation with him regarding this matter. So either it is a coincidence or it got leaked to him somehow via hacks because it is hard for me to accept that some so old on this platform doesnt know about hacks. That might as well be a coincidence though.

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

    I also have the same issue, I don't know how even your template is so same both for @Tashrif2001 and @naivedyam. Probably in my room someone had leaked solution could be the case, I am not exactly sure how it is so similar. Regarding the chat and thing u mentioned 'I don't know about hacks...' I just don't want to do pointless discussions with you since you already have some 4-5 contests already skipped which tells the real deal.