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

Автор FelixArg, история, 12 месяцев назад, По-русски

Neapolis University Pafos

Привет, Codeforces!

Благодаря поддержке Neapolis University Pafos, продолжается серия образовательных раундов.

В 03.06.2025 17:35 (Московское время) состоится Educational Codeforces Round 179 (Rated for Div. 2).

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6 или 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Раунд основан на задачах Первенства города Воронежа по спортивному программированию «VrnCode-2025». Если вы участвовали в этом соревновании, то воздержитесь от участия в раунде.

Почти все задачи в раунде придуманы и подготовлены мной. Хочу сказать спасибо Ивану BledDest Андросову за задачу, которая сделала раунд более сбалансированным.

И еще раз хочу сказать большое спасибо координаторам раунда: Ивану BledDest Андросову и Михаилу awoo Пикляеву за улучшение качества задач и помощь с их подготовкой.

И конечно, огромное спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

Наши друзья из Neapolis University Pafos также хотят передать вам сообщение:

Продолжается прием на бакалавриат по программе "Компьютерные науки и искусственный интеллект" в Neapolis University Pafos!

JetBrains Foundation поддерживает эту программу бакалавриата и предоставляет 20 полных стипендий для самых талантливых абитуриентов. Стипендия покрывает стоимость обучения, проживание, медицинскую страховку, визовые сборы и карманные деньги (300 евро в месяц).

Узнать больше о программе →

Отличные новости! Если вы не успели подать заявку в первом потоке — у вас ещё есть возможность присоединиться ко второму! Подайте документы, пройдите вступительное тестирование и собеседование — и вы сможете получить полную стипендию.

  • Срок подачи заявок – 11 июня 2025
  • Вступительный тест – 15 июня 2025 (это последний вступительный тест 2025 года!)

Кроме того, для студентов, уже обучающихся по направлению «Компьютерные науки», доступны 2 полностью финансируемые стипендии для перевода на второй курс программы.

Если у вас остались вопросы, обращайтесь в Telegram-чат или пишите нам на почту — nup@jetbrains.com! Мы всегда готовы помочь!

UPD: Разбор опубликован

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

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

Hoping that problems will be very easy so that I can reach Master)

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

Hoping for 2000 rating even though 2000 rated problems are killing me nowadays

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

Hoping that problems will be at a decent level maybe theoretic , so that I can reach Pupil :)

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

Hoping that the problems won't accept bruteforce solutions this time.

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

I'm out of competition

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

'

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

I am pig

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

are you femboy ??

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

why there is a lot of femboy in cf?????

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

Hope I will get 1500.

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

"карманные деньги (300 евро в месяц)." soooooooooooqaaaaaaaaaaaa

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

Hoping that problems will be interesting!!!

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

I hope there are educational problems rather than some constructive permutations problem__

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

2 problems this time

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

Its clashing with IPL Final

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

all the best to everyone

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

Super Exited for div 2 .

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

glhf everyone

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

Have a good one folks

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

why it is showing when i try to login with my other account "User is Disabled"

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

Can't solve E, get -ve delta again :(

upd: My idea was correct, but when it couldn't pass sample, I mistakenly thought it was wrong and discarded it:(

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

Awesome contest, thank you for making such a contest!

problem $$$E$$$ was so cool in my opinion

(I hope to reach CM after the hacking phase ^_^)

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

I was thinking of 4d dp solution for div2B for hours , then looked at picture provided got the answer in seconds

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

Why were all the problems upto D of such a low quality(I mean gpt-able) a cheater can easily skim through A to D using AI ;)

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

Order should be C,B,A instead of A,B,C

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

Perfect contest. Thankyou <3

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

how to solve D? zig-zag is optimal right?

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

I spent 30-40 minutes debugging my code for C to finally get to know that I had set the initial value of the ans to INT_MAX which should've been greater than that :( Could've gotten positive delta this round

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

A-D Div3.5

E+ Div 2

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

probably the hardest pair of A and B i ever saw in contest, and then C and D were pretty easy, while E was an okay problem and F seems really cool but wasted too much time on stupid WAs on E :C , cool round overall

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

Could anyone help me to figure out why this submission went wrong on test 4 of E? I had an idea of considering this problem to parenthesis matching: consider c->b->a as ( for c->b and ) for b->a, and b->c->a as [ for b->c and ] for c->a. And I greedily sweep the string, try to convert chars into a in priority. I use ] or ) in priority and split matched parenthesis into ( or [ if no single ] or ) exists. So could someone tell me why I got wrong in E :(

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

    are you doing '(' when ')' does not exist after '('?

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

      Yes I did in submission:

      ...
      else if (c == 'c'){
            if (direct_ca > 0){
              direct_ca--;
              c = 'a';
            }
            else if(match_cba > 0){
              match_cba--;
              c = 'a';
            }
            else if(match_bca > 0){
              match_bca--;
              c = 'a';
            }
            else if (direct_cb > 0){
              direct_cb--;
              c = 'b';// convert to `b` here
            }
          }
      ...
      

      I tried to convert to a if possible, then I will try to convert into b

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

        else if(match_bca > 0){ match_bca--; c = 'a'; }

        why are you doing this? in c=='a'

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

          I converted c into a and spilt b->c->a, for greedily conversation for lexicographic.

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

            what? i don't understand, how are we greedily choosing bca when s[i] = 'c'

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

              Sorry I had compared the output from the accepted code from ranklist and I found the glitch, since you reminded me the way to choose the "matched parenthesis". Here is a hack input:

              1
              5 10
              bbccc
              b c
              b b
              c a
              c b
              a a
              b a
              b a
              a a
              b c
              c a
              

              And the answer is aaaab, but mine got aaaac.

              The cause of wrong answer is that I used match_bca in priority instead of match_cba, which would waste a chance for converting c to b. When I swapped this two branch, I got accepted :)

              Thanks for your time sincerely for reminding the possible problem exists :)

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

    You have paired c-> b and b->a and only use the remaining b->a for direct conversion of b to a. What if the string has many occurences of b in the beginning? And since you paired up your moves you don't have enough b->a left to make the lexicographically smallest string?

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

      I will spilt the matched conversation if necessary, and c->b will restored as unmatched

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

        What you're doing isn't greedily optimal. Suppose that you used 1 match_cba for a conversion of c->a, and then 1 match_bca for a conversion of b->a. Now if there were only 4 operations:

        1. c b
        2. b a
        3. b c
        4. c a

        you will have no operations left. However, it is possible to just use 4th operation to convert c->a and 2nd operation to convert b->a. The remaining operations can still be used to convert 1 c to b.

        Testcase where your code fails:

        1 $$$\newline$$$ 3 4 $$$\newline$$$ cbc $$$\newline$$$ c b $$$\newline$$$ b a $$$\newline$$$ b c $$$\newline$$$ c a

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

how to solve D ?

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

    sort all classrooms based on ClassroomID/100, then pair up each class (you can adjust if n%2==1), then for each pair i, you are gonna give them the classrooms i and n-i-1 (i is 0-indexed, and this is after sorting the classrooms). and those 2 classes will just keep switching between those two classrooms, do this for all pairs. if n%2==1 just make sure you dont overflow since it wont have a pair. you can check my impl for details

  • »
    »
    12 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    for(int i=0;i<n/2;i++){
                int mini = cls[i];
                int maxi = cls[m-i-1];
                cout<<mini<<" "<<maxi<<" "<<
                mini<<" "<<maxi<<" "<<
                mini<<" "<<maxi<<endl;
    
                cout<<maxi<<" "<<mini<<" "<<
                maxi<<" "<<mini<<" "<<
                maxi<<" "<<mini<<endl;
            }
            if(n&1){
                int mini = cls[n/2];
                int maxi = cls[m-n/2-1];
                cout<<mini<<" "<<maxi<<" "<<
                mini<<" "<<maxi<<" "<<
                mini<<" "<<maxi<<endl;
            }
    
  • »
    »
    12 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Zigzag pattern, sort the classes, now observe each group will oscillate between two classes only(group 1 and n will oscillate between classes 1 and m, group 2 and n-1 will oscillate between classes 2 and (m-1) and so on) Be careful for middle group when n is odd and if sufficient number of classes are available to oscillate the middle n.

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

    Hello Tausif

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

D is much easier than it should be.

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

I don't know why less people solve D as compare to C, because D was just normal sorting. Although C was also very easy.

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

Very misleading D

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

I've got tricked by problem D :(

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

am i the only one who thinks A was harder than other problems?

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

Guessforces!

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

C<A<E<D<B

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

didn't feel like an Edu Round. Bar is too high for Edu Round than today's.

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

okk...D was simple zig zag, i don't know why i did some complicated zigzag.

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

Problem E  

we have to find a minimal lexicographical string by applying operations where each character transitions to another character at certain positions.

  1. Represent each operation as a directed edge x → y. Goal: find the lexicographically smallest letter each character can reach.
  2. Compute transitive closure of the graph and get the minimal reachable letter for 'a', 'b', 'c'.
  3. For each character in s, replace it with its minimal reachable letter to minimize the string.

 

  1. Define function $$$D_{q+1}(\ell) = \ell$$$ for each $$$\ell \in {a,b,c}$$$.

  2. For $$$j = q,\,q-1,\,\dots,\,1$$$ and each $$$\ell \in {a,b,c}$$$:

$$$ D_j(\ell)= \begin{cases} \min\bigl(D_{j+1}(\ell),\,D_{j+1}(y_j)\bigr), & \text{if }\ell = x_j,\\ D_{j+1}(\ell), & \text{otherwise.} \end{cases} $$$
  1. The final string is $$$\bigl[D_1(s_i)\bigr]_{i=1}^n$$$.
»
12 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I think D's first sample is very misleading, but the third sample redirected me back to the correct solution

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

can someone help me in finding the mistake here?

https://mirror.codeforces.com/contest/2111/submission/322754971

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

    My submission for E, wrong on 2nd test case. 43rd words differ. I wish I could know what that test case was!

    first, i keep track of all b and c. if b — a , i do it. Same for c — b.

    if b — c, i keep a counter, gonna need it if i find c — a.

    for c — a, if b — c counter positive and that b's position is smaller than current c, then that b will be a. (via b -> c -> a). Otherwise, just convert earliest c to a.

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

I started the contest really slowly cuz I was doing it during a class lol. Luckily I bounced back with D and E afterwards by just being brazen with it. btw, for anyone looking for a tutorial on E, this is all I wrote down and it worked:

Notes on problem E

Note that you still need to be careful as to removing the first or last occurrences of each type of operation as you use them, keeping track of them in a map/set or similar.

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

what is the solution of a . By guessing i figured it was the no of digits in binary representation but how?

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

for some reason i found A more Difficult than C. As A newbie i would say B>A>C in difficulty is what i felt. A took too much time for me although i was little late to the contest, Took more time than expected. B was very interesting Once visualized that after stacking largest two cubes you can always fit the other cubes in some fashion C i could imagine it as islands trying to capture other islands land and it worked out.

newbie.

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

D is too simple, even simpler than B, this makes me confused, thinking if there exist any special cases and thus i wasted a lot of time.

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

Can someone please help with problem A.. Not able to solve it

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

As a newbie i felt B>A>C.

  • A: took more time than i expected it would, although i was a little late to start the contest.
  • B: Was very interesting, once you notice that after stacking the largest two cubes the other cubes always fit in some fashion, This was actually shown in the nice image in the Question. (nice authors)
  • C: I imagined this as a islands trying to capture other islands, and that helped, me although at first i had attempted a half cooked approach, which resulted in a -1 in C
  • D: did not get time. :( -signing off, newbie.
»
12 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

https://mirror.codeforces.com/contest/2111/submission/322756208

the hack looks sus... I maybe wrong but still it seems like the solution deliberately wanted to get hacked..

" if(n > 1 && arr[0] == 500000 && arr[1] == 499999) { return void(cout << 249999000001 << '\n'); } int64_t sum = 0; "

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

I don't know why everyone thinks B was hard? You just had to look at the shape to realize that the first two should fit You just had to look at the Fibonacci sequence of the sides with an inductive view to realize how every ni — ni-1 = ni-2

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

Missed E because of one continue statement.

322745440 322759713

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

322720874, 322745486 what a coincidence!

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

G and https://mirror.codeforces.com/problemset/problem/1887/D are the same problem, except that G is forced online. Change the binary indexed tree of 1887D to a persistent segment tree, then you can get accepted in G.

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

Problem 'A' seems harder than B,C,D for me. Did anyone feel like that?

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

322764289

MLE in test2 problem D

HELP...........

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

I registered in this contest as rated participant why is it showing up as unrated for me ?

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

I got TLE for 5th case in python 322700139

i don't understand why? There's no more complexity that getting the inputs

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

Felt happy solving 4 problems... only to see 3500+ people ahead even on the day of the IPL final!!!

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

Shoudln't have attended this one, was too tired.

A destroyed me. Hardest A I've ever seen.

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

GreedyForces

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

EDUCATIONAL GREEDY-FORCES ROUND

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

How to solve problem F

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

    Here is the idea I implemented. I'd be very curious to see whether other people came up with different solutions!

    The first step is to find a general source of constructions: Start from a square of side x (so perimeter 4x, area x^2), and remove some squares from the top right. This does not change the perimeter but decreases the area, giving a construction for p = 4x, and 2x-1 <= s <= x^2.

    For the given p and s this probably won't work (for one, the perimeter might not be a multiple of 4). However, note that you can scale p and s up by the same factor. We can make the above construction work for pk, sk as long as|

    • k is a multiple of 4
    • p/2 <= s
    • s <= (pk/4)^2

    and it turns out that if p <= 2 s, k = 200 should always work.

    Finally, we need to decide what happens when p > 2s. For instance, with just one square we can achieve p = 4 and s = 1, while there are other situations that are not solvable.

    Suppose we have a polyomino with perimeter p and area s. It is not hard to observe that p <= 2s + 2: indeed, equality holds when there is only one square, and each time we glue an additional square, we add 4 edges to the total, but glue 2 together, contributing at most 2. Moreover:

    • When p = 2s+2 we can just place s squares in a line.
    • We cannot have p = 2s+1, since the perimeter is always even.

    Therefore, when p > 2s in the input, we check whether p/s = (2k+2)/k for some k. If yes we have a construction. If no, output -1.

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

chatgpt can solve F with no input from the user

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

    your code looks very nice! i love how they have so many comments explaining every bit of code. Does using chatgpt help you perform well?

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

      I recently started trying to use copilot yea. I sometimes tell it what to do in a function in a comment and it just does it for me and stuff, if it's simple enough. I am pretty sure copilot is allowed, however. Core logic is all mine and stuff. It is quite sad to see that these AIs are better than me though. I couldn't solve F but it did it so fast...

      A point to consider is that at SWERC Lyon a JetBrains code editor with built-in code completion similar to copilot was allowed, so yeah

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

Should we use different testcases for every hack? why blocked from hacking?

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

Difficulty estimations

A — 800

B — 1100

C — 1200

D — 1400

E — 1800

F — 2200

G — 2500

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

The problem of the contest were so tricky but i love :)

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

Solution for E, with comments explaining.

#include <bits/stdc++.h>
using namespace std;

// the relevant paths are: c->a OR (c->b, b->a) OR c->b OR b->a OR (b->c, c->a)
// if you find a "c" and you have a c->a somewhere, delete the earliest c->a and change the c to an a
// if you find a "c" and you have a c->b, b->a somewhere, delete the earliest instance c->b and earliest b->a
// if you find a "c" and you have a c->b somewhere, delete the last instance c->b
// if you find a "b" and you have a b->a somewhere, delete the earliest instance b->a

// ALWAYS TAKE c->a over (c->b, b->a) if its on offer. no cost to taking it.
// ALWAYS TAKE b->a over (b->c, c->a) if its on offer. no cost to taking it.

int main(){
    int t, n, q;
    string s;
    char a, b;
    cin >> t;
    while(t--){
        // n characters, q operations inorder
        cin >> n >> q >> s;
        // a->b, a->c, b->a, b->c. c->a, c->b
        set<int> abset, acset, baset, bcset, caset, cbset;
        for(int i = 0; i < q; i++){
            cin >> a >> b;
            if(a == 'a' && b == 'b') abset.insert(i);
            else if(a == 'a' && b == 'c') acset.insert(i);
            else if(a == 'b' && b == 'a') baset.insert(i);
            else if(a == 'b' && b == 'c') bcset.insert(i);
            else if(a == 'c' && b == 'a') caset.insert(i);
            else if(a == 'c' && b == 'b') cbset.insert(i);
        }
        for(char c : s){
            char output = c;
            if(c == 'c'){
                //remove the first ca, to interfere with bc, ca as little as possible
                if(caset.size() > 0){
                    caset.erase(caset.begin());
                    output = 'a';
                }
                else if(cbset.size() > 0 && baset.size()){
                    auto first_incompat_cb = cbset.lower_bound((int) *prev(baset.end()));
                    // remove the very last ba, and the last compatible cb
                    if(first_incompat_cb != cbset.begin()){
                        cbset.erase(prev(first_incompat_cb));
                        baset.erase(prev(baset.end()));
                        output = 'a';
                    }
                }
                if(output == 'c'){
                    //remove the very last cb, to interfere with cb, ba as little as possible
                    if(cbset.size() > 0){
                        cbset.erase(prev(cbset.end()));
                        output = 'b';
                    }
                }
            }else if(c == 'b'){
                // remove the first ba, to interfere with cb, ba as little as possible
                if(baset.size() > 0){
                    baset.erase(baset.begin());
                    output = 'a';
                }
                // remove the very last ca, and the last compatible bc
                else if(bcset.size() > 0 && caset.size() > 0){
                    auto first_incompat_bc = bcset.lower_bound((int) *prev(caset.end()));
                    if(first_incompat_bc != bcset.begin()){
                        bcset.erase(prev(first_incompat_bc));
                        caset.erase(prev(caset.end()));
                        output = 'a';
                    }
                }
            }
            cout << output;
        }
        cout << "\n";

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

322764289

Explain why this submission resulted in the particular verdict.

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

Let me tell you a joke, I didn't write question A for an hour, but I did BCD within an hour, and in the last 2 minutes, I guessed A.

GussForces

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

can anyone please tell me why am i unrated still after my first participation?

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

Why C and E getting hacked too much? , i mean is there a common flaw?

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

why did i not gain any rating i solved A :v

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

Can anyone provide a test case or can tell where this code for Problem C will fail..(Except TLE)..I am not able to figure it out.


#include <bits/stdc++.h> using namespace std; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t; cin>>t; for(int i=0;i<t;i++){ int n; cin>>n; vector<int>arr(n); for(auto &x:arr) cin>>x; map<int,pair<int,int>>pos; for(int i=0;i<n;i++){ if(pos.find(arr[i])==pos.end()){ pos[arr[i]].first=i; pos[arr[i]].second=i; } else pos[arr[i]].second=i; } long long cost=LLONG_MAX; for(auto it:pos){ long long ai = it.first; long long fi = it.second.first; long long li = it.second.second; int flag=0; for(int k=fi+1;k<li;k++){ if(ai!=arr[k]){flag=1;break;} } if(flag==0) cost = min(cost,fi*ai + ai*(n-li-1)); else{ cost = min(cost,fi*ai + ai*(n-fi-1)); cost = min(cost,li*ai + ai*(n-li-1)); } } cout<<cost<<endl; } }
»
12 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I only rate at about 8000,will I be out of speclist(cry

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

Editorial out yet?

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

I didn't understand the statement of problem A but I guessed the answer

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

For problem E, how is the expected output "b" for following testcase(9th part of 2nd testcase)

1

1 3

c

a b

b a

c b

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

For E, can someone help me figure out why my solution is returning WA on test case 2?

My idea is to 'cache' c-b and b-c for later use, and edit the earliest possible letter in the string when encountering b-a or c-a (at the end I make sure to use all leftover c-b). This works in O(N+Q) for any input I can think of, but fails on the 420th input of test case 2 (which I am not able to see).

Any help is appreciated. Please let me know if you would like clarification on the code.

322827978

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

My Code.

Could anyone help me debug this code? I've been debugging for five hours but made no progress. I would be extremely grateful if you could take a look.

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

Hi MikeMirzayanov, I noticed my submission is being flagged for similarity with (handle: Ha7NBaTop). Please note my submission was made at Jun 03, 2025 21:28 (ID: 322733209) during Educational Codeforces Round 179, whereas his submission was at Jun 03, 2025 21:50 (ID: 322745226) — 22 minutes later.

Additionally, our codes have different logic and structure, so I don’t understand why mine is considered plagiarized. I kindly request a review of this, as I wrote my solution independently and earlier.

Thank you!

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

Hi MikeMirzayanov,

I recently received a message saying that my submission to Problem 2111D (submission ID: 322725889, handle: shivamcy) was found to be very similar to a large number of other submissions. I’d like to clarify that I wrote the entire code myself during the contest and did not copy or share my solution with anyone.

I’ve been using the same personal template (for fast I/O and vector handling) in all my submissions, which might explain some common structure. Also, since the problem only required any valid solution that maximizes movement between floors, the idea of sorting classrooms based on floor numbers and picking extremes from both ends is pretty intuitive. That’s likely why many of the solutions ended up looking similar, even if written independently.

I didn’t upload or share my code on any public platforms like Ideone or GitHub during or after the contest, and I didn’t communicate with anyone about the problem. If needed, I’d be happy to share more details or answer any questions to help clear things up.

Thanks for looking into this, and I really appreciate the work you do to keep Codeforces fair for everyone.

Best regards, shivamcy

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

Hello Codeforces team, I received a message stating that my solution for problem 2111C (submission ID: 322691374) coincides with many other participants’ submissions. I want to clarify that I wrote my solution independently. The technique I used is based on a method I learned from a GeeksforGeeks blog that was publicly available before the contest. It’s possible that many other participants referred to the same source and applied the same logic, which might have led to this similarity. I did not share my code with anyone, nor did I copy from anyone else during the contest. I also did not use any public IDEs that could have exposed my solution. Please consider reviewing this case. I am happy to provide the link to the GFG blog I used or answer any further questions.

Thank you.

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

    I’d like to clarify that I wrote my solution independently. The problem was a standard type — involving keeping track of group counts and performing forward and backward iterations to maintain a balance or compute totals.

    This kind of technique is commonly used in many competitive programming problems, and I referred to similar patterns on platforms like GeeksforGeeks to better understand the approach. Given that the idea is quite standard, it's entirely possible that many other participants arrived at a similar implementation independently.

    I respect the platform's integrity and did not engage in any kind of copying or collaboration during the contest. I’m committed to fair participation and would appreciate your understanding in this matter.