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

Автор sevlll777, 4 года назад, По-русски

Hello Codeforces!

Невероятно рад пригласить вас на Codeforces Round 860 (Div. 2), который пройдёт в 26.03.2023 17:35 (Московское время).

Раунд будет рейтинговым для всех участников, чей рейтинг ниже 2100. Участники с бóльшим рейтингом приглашены принять участие в раунде вне конкурса.

Вам будет дано 6 задач и 120 минут на их решение. Все задачи раунда придуманы и подготовлены мной.

Традиционный список благодарностей всем, кто принял участие в создании раунда:

🤴 DishonoredRighteous за координирование раунда

🐞 gyh20 за чёрно-красное тестирование раунда

😈 feecIe6418, iakovlev.zakhar, Dart-Xeyter, Adam_GS, ShuiLaoshi, golikovnik, Gary2005 за красное тестирование раунда

🐫 NemanjaSo2005, Alexdat2000, Kon567889, tem_shett за оранжевое тестирование раунда

👾 SlavicG, Psychotic_D за фиолетовое тестирование раунда

🐳 C2A, Masha237, ayhan23, Dhru008, Brahma_tet за синее тестирование раунда

👽 Lord_David за зелёное тестирование раунда

🦄 mejiamejia за помощь с тестерами для раунда

🤡 sevlll777 за задачу, без которой раунд был бы несбалансирован, и задачи, которые не вошли в финальную версию раунда

🎅 MikeMirzayanov за потрясающие платформы Codeforces и Polygon, без которых проведение раунда было бы невозможно ㅤㅤㅤ

Персональные рекомендации

Я искренне надеюсь, что задачи покажутся вам интересными и вы получите удовольствие от их решения. Good luck!

Разбалловка:

500 — 750 — 1250 — 1750 — 2250 — 3000

UPD: Разбор

UPD2: Поздравляем ЧЕМПИОНОВ!

Неофициально:

  1. jiangly

  2. A_G

  3. neal

  4. maspy

  5. turmax

Официально:

  1. satyam343

  2. Sunnatov

  3. RGB_ICPC7

  4. amirhoseinfar1385

  5. vbgladkikh

First AC:

A: nifek

B: p0tato

C: p0tato

D: aryan12

E: NaughtyMorzh

F: zihouzhong

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

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

As a tester, I recommend you try every problem.

PS: sevlll777 tried a lot to make a good round for you guys.

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

It isn't at the main page after 7 hours, wow...

As a tester, I'm a little surprised :)

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

Cyan tester?

»
4 года назад, скрыть # |
 
Проголосовать: нравится -166 Проголосовать: не нравится
✅ Maximize your enjoyment of the contest, not your rating after it

Sounds like a bad round in advance.

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

1750 problems are rather rare these days.
Kudos to authors for having them

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

Red round

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

I have one rating point left to raise to Specialist, I sincerely hope that I will raise it this round.

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

Since this round is rated for only participants below 2100, I don't see why legendary grandmasters are required for testing.

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

    Legendary grandmasters have more experience than anyone else. They will probably be much better at pointing out things like if a problem has appeared before, if there exists a stupid data structure brute force, if the authors' intended greedy is incorrect and the problem is actually unsolvable, etc.

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

Hopefully my CM contest

I followed the author long time ago because his codes are brilliant and clean so I'm expecting some great problems tomorrow < 3

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

This amount of emojis makes me die inside

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

Ух ты, оригинальный анонс и ранняя разбаловка! Определённо участвую

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

Emoji round

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

How can one become a tester?

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

I am eagerly waiting for this contest...I think I will reach PUPIL by this contest....Let's Hope for the best....I will definitely never give up even I cant make my name green....

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

Early Score Distribution!

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

As a blue tester, best contest I have ever seen!

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

On the behalf of the specialist community i would like to say this time D is 1750. And you lot know what it means right!!

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

As this is my first testing round, I'd like to thank sevlll777 for giving me this opportunity. It was a lot of fun for me.

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

As this is my first testing round, I'd like to thank sevlll777 for giving me this opportunity. It was a lot of fun for me.

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

In div2 contest!

me BEFORE CONTEST
me AFTER CONTEST is over!
»
4 года назад, скрыть # |
 
Проголосовать: нравится -11 Проголосовать: не нравится

Wishing all the best to everyone,

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

Participants with a higher rating are invited to participate in the round unofficialy.

Should be:

Participants with a higher rating are invited to participate in the round unofficially.

Update:Fixed.

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

    ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⣀⣀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣴⣞⠉⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⢑⣶⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⣿⣿⣿⣿⣿⣶⣤⣀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⢀⣤⣴⣤⣤⣤⣤⣤⣤⣤⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣥⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣽⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣄ ⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋ ⠀⠀⠀⢹⣿⣿⣿⠛⠛⠛⠛⠛⠛⠛⢛⣛⣻⣟⣛⠛⠛⠛⠛⠛⠛⠛⢻⣿⣿⣿⣿⡟⠛⠛⠛⠛⠛⠛⠛⢛⣛⣿⣛⣛⠛⠛⠛⠛⠛⠛⠛⠛⣿⣿⣿⡏⠀⠀ ⠀⠀⠀⢘⣿⣿⣿⡀⠀⣠⠋⠉⣣⠾⣿⣿⣿⣿⣿⡟⠢⡀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⠀⠀⠀⢠⠊⡩⢿⣿⣿⡀⠀⠀⠙⢦⡀⠀⠂⠀⠀⢸⣿⣿⣿⠀⠀⠀ ⠀⠀⠀⠀⢿⣿⣿⡇⠀⣇⠀⢰⣹⢁⣿⣿⣿⣿⣿⣿⣀⢹⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣇⠀⠀⣇⡼⠁⣸⣿⣿⣷⣥⣀⠀⠀⢱⠀⠀⠀⠀⣾⣿⣿⡇⠀⠀⠀ ⠀⠀⠀⠀⢸⣿⣿⣷⠀⠈⠒⢺⣧⣼⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⡀⠀⠈⣷⣿⣿⣿⣿⣿⣿⣿⣆⠀⢸⠀⠀⠀⢀⣿⣿⣿⠆⠀⠀⠀ ⠀⠀⠀⠀⠈⣿⣿⣿⣔⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠙⣿⣿⣿⣿⣿⣿⣿⣿⣧⠏⠀⠀⠀⣼⣿⣿⡿⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⢹⣿⣿⣿⣦⡠⠀⠀⠛⢿⣿⣿⣿⣿⡿⠋⠀⠀⣠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠁⠘⢿⣿⣿⣿⣿⣿⠟⠁⠀⠀⢀⣼⣿⣿⡿⠃⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣶⣤⣤⣤⣬⣽⣽⣁⣠⣦⣴⣾⣿⣿⣿⣿⣏⢉⣭⣽⣿⣿⣿⣿⣿⣶⣤⣤⣈⣩⣭⣭⣥⣤⣤⣴⣾⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⡏⠙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣼⡏⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⠇⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⢇⠀⠀⠀⣭⡙⠛⠛⠛⠛⠛⠛⠛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠛⠛⠛⢛⣟⠛⠉⠁⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⢸⡀⠀⠀⠙⠁⠀⠀⠀⠸⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣶⠀⠀⡸⠿⠀⠀⠀⠀⡏⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢧⠀⠀⠀⣤⡀⠀⠀⠀⠈⠀⠀⠀⢀⣴⣦⣤⠤⠤⠤⠤⠤⠤⠤⢤⣤⣶⣤⡀⠀⠀⠘⠋⠀⠀⠀⠀⠀⠀⠀⣸⠁⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠈⢇⠀⠐⠙⠃⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⡧⠀⠀⠀⠀⠀⠀⢠⡄⠀⠀⣰⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⣇⠀⠀⠀⠀⠀⠀⠀⠀⣼⠋⠉⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⣰⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠋⠳⠶⠶⠶⠖⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡜⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠳⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠔⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠲⢤⣠⣀⣀⡀⠀⠀⣀⣠⡀⠀⡀⢀⡀⢀⣀⣦⣤⡾⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣾⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡖⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠻⠿⠿⠿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⠛⠋⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

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

Hope the site will work fine.

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

Hope I'll turn CM soon :(

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

Leetcode went down today during the Weekly Contest. All in on codeforces now

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

As a tester. This is an actually good round. Try every problem.

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

Would it be an AI themed contest? sevlll777

Like Codeforces Round 770 (Div. 2)

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

Specialist day, I hope

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

hope rating++

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

NEW ICONS!!! Oh, wait....

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

When I am trying to login via my main account it says user is disabled by administrator? What does it mean? Is it a ban and if yes for how long or is it a bug? Like my main account wasn't being plagiarized too in recent rounds? Please do help.

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

I think, C problem 3rd test case output is wrong. pack 1 and pack 5 can have same price tag.

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

Swap(C,D)

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

I literally took 3mins to solve D after reading it , & couldn't solve C , lol.

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

D<<<C

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

Who else facepalmed when they saw the announcement reminding the condition that the price tags have to be continuous?

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

Ok, I obviously don't get it:)
What so obvious easy was about C and D?

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

My brute force solution passed the pretest of E. Weak pretest. Hope it will get FST.

Update: My solution passed system test. Weak system test. I'll uphack my solution later.

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

Anyone else thought that you can change the order of types of candies on the shelf? I wasted too much time on that :(

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

So how to solve problem D?

Construction is so hard. :(

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

    Just greedy in a somewhat stupid way. It is easy to find this way but it is not instantly obvious why it works.

    • »
      »
      »
      4 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится
      while(i<pos.size()&&j<neg.size())
      		{
      			if (ok==0)
      			{
      				int res=0;
      				while(j<neg.size()&&sum>=0&&abs(res+neg[j])<k) ans[++cnt]=neg[j],sum+=neg[j],res+=neg[j],j++;
      				ok^=1;
      			}
      			else
      			{
      				int res=0;
      				while(i<pos.size()&&sum<=0&&abs(res+pos[i])<k) ans[++cnt]=pos[i],sum+=pos[i],res+=pos[i],i++;
      				ok^=1;
      			}
      		}
      

      It is my greedy... But wrong at pretest 2...

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

        Sorry, I did not read your code but my solution was:

        First, split array to pos and neg. Also calculate number of zeros.

        Then this greedy

          ll ssum = 0, p0 = 0, p1 = 0;
          while(p0 < sz(pos) && p1 < sz(neg)) {
            if (ssum + pos[p0] < MAX) {
              ssum += pos[p0];
         
              cout << pos[p0] << ' ';
              p0++;
            } else {
              ssum += neg[p1];
         
              cout << neg[p1] << ' ';
              p1++;
            }
          }
         
          while(p0 < sz(pos)) {
            cout << pos[p0++] << ' ';
          }
          while(p1 < sz(neg)) {
            cout << neg[p1++] << ' ';
          }
          rep(i, 0, zeros) {
            cout << "0 ";
          }
        
      • »
        »
        »
        »
        4 года назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        Input can be all zeros.

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

      Pretty sure it was something about Kadane's algorithm but I got too cought up in c too much

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

        So what is Kadane's algorithm?

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

          Basically a greedy algorithm that lets you find the maximum sum subarray when negative numbers are present. You keep a current score and iterate through the full array while also keeping the max score somewhere. If a number is positive, you take it and add it cause it makes score better. If there is a negative number you have 2 cases. Case one is if the score would be negative then you simply set score to 0 (because taking the number would be worse than having nothing) case 2 is if the score after adding the number would be more than zero, in that case you just add it to the score because it might be worth it later

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

          It gives the maximum sum among all of the subarray from an array.

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

    If every element is equal to zero -> no answer.

    Otherwise, group elements in two vectors: positive+zero and negative.

    You build the final array as follows: Keep a variable sum denoting the sum of all elements used up to this point.

    if sum > 0 you append the next negative value to the final array

    if sum =< 0 you append the next positive or zero to the final array

    Largest absolute value of a subarray sum is the largest absolute difference between any two prefix sums. Let max equal the largest value and let min equal the smallest value of the array. You can notice that if currently sum > 0, the next prefix sum will satisfy sum > min and if currently sum <= 0, the next prefix sum will satisfy sum <= max. This means that all prefix sums satisfy min < sum <= max. The largest possible prefix sum is thus max and the smallest possible is min + 1. The absolute difference of these is less than max - min which satisfies the problem statement.

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

      Can u tell what's wrong in my approach: What I am doing is just instead of 0, I am storing max(A) — min(A) into a variable r, then whenever abs(sum of elements + new_element) > r, then start storing elements of opposite sign and so on

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

        The maximum value of prefix sum in your case is going to be r — 1 while the minimum value of prefix sum will be -r + 1.

        The difference between both will be greater than r, which means there might be some subarray that will exceed the allowed sum r.

        I don't know how you implement it but yeah seems like this will definitely fail.

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

    Thanks all above :)

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

Was there any specific tricky case in E? I think I had an almost correct solution (with precalculation of how many correct tests we will have starting from position i using dp with memoization and maximums on suffix on result of this dp) but I have always got WA 3 :(

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

"Shocking Arrangement" is the title of problem D. Yes, indeed.

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

Did anyone else FST B on test 6?

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

Can anyone explain how they quickly proved D? I thought about the correct greedy solution but couldn't prove it.

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

    Copied fom my previous comment:

    If every element is equal to zero -> no answer (trivial to prove).

    Otherwise, group elements in two vectors: positive+zero and negative.

    You build the final array as follows: Keep a variable sum denoting the sum of all elements used up to this point.

    if sum > 0 you append the next negative value to the final array

    if sum =< 0 you append the next positive or zero to the final array

    Largest absolute value of a subarray sum is the largest absolute difference between any two prefix sums. Let max equal the largest value and let min equal the smallest value of the array. You can notice that if currently sum > 0, the next prefix sum will satisfy sum > min and if currently sum <= 0, the next prefix sum will satisfy sum <= max. This means that all prefix sums satisfy min < sum <= max. The largest possible prefix sum is thus max and the smallest possible is min + 1. The absolute difference of these is less than max - min which satisfies the problem statement.

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

    I didn't lol. It just kinda made sense :/

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

I am not sure if this is the solution for F (didn't implement on time) but it rests on this key claim which I cant really prove or disprove: If I have a class of size k and I have at least 2*k-1 bags, I can always find a knapsack of size k divisible by k.

Suppose this is true, then its always possible and I can just take knapsack from small to big. Can anyone prove or disprove the claim?

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

My solution on C 199304839 gets TL7. I have no idea how to speed up it (without writing more optimal solution).

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

Anyone knows why my submission for E is wrong?

https://codeforces.me/contest/1798/submission/199302004

My algorithm:

Spoiler
  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится
    Explanation
  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится +9 Проголосовать: не нравится

    Take a look at Ticket 16777 from CF Stress for a counter example.

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

very hard problemset

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

So big gaps between B and C...

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

very hard problems

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

Amazing round! Really cool problems.

Screencast with commentary

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

what was the proof for problem D ..

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

Why is D in this position?

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

Problems were really hard. D was easier than C and C was hell of a hard problem (I understand that C was lcm and gcd, but you still had to think how to fit this operations into problem, which was not an easy task).

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

Great contest, but I personally found D easier than C. Anyone share the same thought?

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

A: For 1<=i<=n-1 check for every pair of (a[i], b[i]) if one of the following is true: (a[i]<=a[n] && b[i]<=b[n]) or (b[i]<=a[n] && a[i]<=b[n]), which is equivalent to min(a[i], b[i])<=min(a[n], b[n]) && max(a[i], b[i])<=max(a[n], b[n]).

B: Check participants reversely. We need to maintain a set of participants in the future, and from today's participants we need to find a participant which is not in the set.

C: The equivalent condition of "we can use same price tag for [L, R]" is gcd(a[L]*b[L], a[L+1]*b[L+1], ..., a[R]*b[R]) % lcm(b[L], b[L+1], ..., b[R])==0. Thus we can solve by dp: let i be the minimum index that we can use same price tag for [i, j], we let dp[j]=dp[i-1]+1. We can find such i by binary search, and we need to process range query by some data structures like sparse table.

  • Note that lcm(b[L], b[L+1], ..., b[R]) could be very large. But since the condition we check need it to be less that max(a[i])*max(b[i])=10^13, we can regard all large values as 10^13+1.

D: If all of a[i] is zero, there's no solution. Otherwise, we can ignore zeros (since they don't contribute to sum of subarrays and can be placed everywhere) and maintain the current prefix-sum. If sum<=0 we append a positive number to the array, otherwise we append a negative number until we used all numbers. Because the total sum is zero, we always have unused number with the sign we want, and every prefix-sum of the array we build is in the range [-min+1, max].

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
___,,___
                            ,d8888888888b,_
                        _,d889'        8888b,
                    _,d8888'          8888888b,
                _,d8889'           888888888888b,_
            _,d8889'             888888889'688888, /b
        _,d8889'               88888889'     `6888d 6,_
     ,d88886'              _d888889'           ,8d  b888b,  d\
   ,d889'888,             d8889'               8d   9888888Y  )
 ,d889'   `88,          ,d88'                 d8    `,88aa88 9
d889'      `88,        ,88'                   `8b     )88a88'

d88' 88 ,88 888b,_ d888888 d89 88, 88 d888b 88_ 8888 88 88b 88 d888888 8: (6) 88') 88 8888b, 88 d888aaa8888, 'Y' 88b ,888888888888 d88aa88888b ,d8 88b ,8888688888888 d88a d8a88` 8/ q8b ,88'888888'"88 d8b d8888, 88/ 9)_6 88 ,88" 88 88p88 d88888888888bd8( Z~/ 88b 8p 88 68' 88 88888888'688889 88 8 8 8,88 888 8888,qp' 8 8, q 8b88 88" 888b q8 8b "8888888' "888 `q88b "888'

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

I proof by AC-d problem D lol

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

One of the best contest !

In Problem C, One fine observation can convert Binary Search Solution to Linear Solution.

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

Hello, may I ask why my D get punished while submitting again after AC

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

    That is how codeforces rules work. The following is taken from here:

    If a contestant submits several times a problem's solution that passes all pretests, then the last solution is considered as the contestant's verified solution for this problem. All other solutions will be considered as unsuccessful attempts.

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

Why does the pretset data of D not have 3e5 so I got fst?

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

Why does the pretset data of D not have 3e5 so I got fst?

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

Can someone please help explain why my code doesn't work for C? I spent over an hour debugging but it still doesn't pass the first test case.

https://codeforces.me/contest/1798/submission/199296745

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

D was wayyy easier than C.

I feel dumb for not taking the 2nd suggestion seriously TwT
»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

D got FST(RE) because of the weak pretest:(

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

Problem D has weak pretest (no testcase with maximum input size)

Problem E has weak system test (allow brute force solutions)

How did they tested this contest

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

Anyone knows why my solution to B is giving TLE?

https://codeforces.me/contest/1798/submission/199298313

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

I came up with a nlogn solution for D but unfortunately could not prove it. Can anybody please take a look? Feel free to hack if it is wrong. I just want to know whether it is correct.

https://codeforces.me/contest/1798/submission/199291200

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

In Problem B I got AC in contest but now it is showing WA on test case 12

Why?

https://codeforces.me/contest/1798/submission/199291886

it seems to be fine for me

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

    oh so Now I got AC so basically have to used long long sum instead of int sum

    but why they didnt show me WA in contest time if this was the issue

    my rating now will be highly affected by this

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

      You didn't get WA during contest because your code is only ran on pretests during a contest. This doesn't include all tests that your solution will be run on after contest, so you can only assume that your solution is probably correct.

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

I solved C with three segment tree and didn't solve D. These turn out that I don't have brain.

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

    what was your approach for C?

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

      First, consider when $$$c_l=c_{l+1}=\cdots = c_{r}$$$. The optimal $$$d$$$ is $$$d_i = \dfrac{\text{lcm}(b_l,b_{l+1},\cdots,b_r)}{b_i}$$$(according to the definition of $$$\text{lcm}$$$). Then if $$$\forall l \le i \le r ,d_i | a_i$$$, it meets the condition. Let $$$l=\text{lcm}(b_l,b_{l+1},\cdots,b_r)$$$. $$$\forall l \le i \le r ,\dfrac{\text{lcm}(b_l,b_{l+1},\cdots,b_r)}{b_i} | a_i \iff \forall l \le i \le r ,\dfrac{l}{b_i} | a_i \iff \forall l \le i \le r ,l | a_i \cdot b_i \iff l | \gcd(a_l \cdot b_l,a_{l+1} \cdot b_{l+1}, \cdots , a_r \cdot b_r)$$$. So we can use two segment trees maintain $$$\text{lcm}(b_l,b_{l+1},\cdots,b_r)$$$ and $$$\gcd(a_l \cdot b_l,a_{l+1} \cdot b_{l+1}, \cdots , a_r \cdot b_r)$$$.

      Second, consider how to get the answer. Let $$$dp_i$$$ means the answer of $$$[1,i]$$$. We can use binary search to get the minimum $$$j$$$ that $$$c_j = c_{j+1} = \cdots = c_i$$$. Then $$$dp_i = \min\limits_{k=j}^i dp_{k-1}+1$$$. We can use another segment tree to maintain the minimum $$$dp_i$$$ in a range.

      Finally, $$$dp_n$$$ is the answer. (Sorry to my poor English and expression)

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

Though C is too hard for it's position, CD are great and E is very beautiful! Thanks for the problemset!

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

.

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

✅ Maximize your enjoyment of the contest, not your rating after it

Agree, 100% (delta=-100), absolutely loved C! I guess problems C and D could have been swapped. Although that probably would've given away the solution to the current D, if it were C.

Thanks again for the amazing contest!

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

https://codeforces.me/contest/1798/submission/199273765

Can someone explain why this solution got runtime error on c?

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

https://codeforces.me/contest/1798/submission/199317662

Can someone explain why this solution of c got a runtime error?

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

satyam343 orz comment. Satyam is a legendary grandmaster in disguise.

He is the women's pet, men's regret and if you bet against him, it is a bad bet.

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

Good contest! Finally reached specialist

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

Well at least i solved C alone, although it was after round ended.

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

Can anyone tell me why in Problem D they said that the sum of all elements is $$$0$$$? The way I proved my solution didn't use this fact at all.

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

A great contest,problems are interesting and educational!

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

it was a great round!

greetings to everyone who worked on this round <3

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

Finally became specialist... Codeforces Round 860 (Div. 2) was great overall

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

Today I got a message of code copying with someone named VRSancheti. I even don't know him/her and our code is also different to a great extent and only logic is same. I had just copied boilerplate from Internet which may have resulted in same code(as he/she might have copied the same boilerplate from Internet). Yet my all questions have been made wrong. I honestly wrote my code on VScode and submitted it. Please look into this matter and take necessary action.

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

Your solution 199301914 for the problem 1798C significantly coincides with solutions Ultraspeedforces2/199298118, madhurgupta185/199301914. My ratings of this contest have been reverted back. It was a simple problem. Why would I take code from someone who is a newbie.I have been using the same template for a long time. Please look into the matter and take necessary action. Please do look into the matter MikeMirzayanov