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

Автор AdvancerMan, история, 6 лет назад, перевод, По-русски

Привет, Codeforces!

Мы рады пригласить вас на Codeforces Round #610 (Div. 2), который пройдет в 24.12.2019 17:35 (Московское время). Он будет рейтинговым для всех участников, чей рейтинг ниже 2100. Вам будет предложено шесть задач и два часа на их решение.

Задачи были придуманы и подготовлены коллективом университета ИТМО Supermagzzz, Stepavly, AdvancerMan, unreal.eugene, MikeMirzayanov.

Особую благодарность выражаем MikeMirzayanov за замечательные системы Codeforces и Polygon, а также за координирование нашего раунда.

UPD1: Выражаем благодарность команде тестеров университета ИТМО: budalnik, Alexxx, Darui99, golikovnik, sharepoLOVEDDD, Mr.Hakimov, zergey.gad, MeowMr, Ilya-bar, 1ncendiary

Одна из задач раунда будет интерактивной. Вы можете прочитать руководство по интерактивным задачам здесь.

UPD2: Разбалловка: 500 — (500 — 1000) — 1750 — 2500 — 2500

Надеемся, вам понравятся задачи. Удачи и высокого рейтинга!

UPD3: Поздравляем победителей!

  1. Tsypkokokokoko
  2. K.Yuuki
  3. hyhtsdy
  4. ptica
  5. junukwon
  6. gumnam
  7. AnotherRound
  8. conqueror_of_obd
  9. rtilikay
  10. p1rattttt

Разбор будет опубликован в ближайшее время.

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

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

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

Меня очень баттхёртит еспокоит, что пешки Мирзаянова могут проводить два контеста

спойлер

в месяц, а остальные ждут в очереди по полгода

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

Any subtasks?

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

I am very worried about the fact that Mirzayanov’s pawns can hold two contests a month, while the rest are waiting in line for six months

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

Hello everyone — Good luck for all I hope I can become a Candidate Master after contest

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

Before round:

Round is rated for Div.2 participants

After round:

UNRATED!

Sad story......

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

Finally there is an interactive problem after 9 rounds ! :D

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

hope interactive problem is not a binary search. pleaaase

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

are there interactive problems in ICPC contests !

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

hope for short statements like the last round !

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

it's look like interesting contest

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

Can someone please explain what is an interactive problem and whats the difference between and regular problem and an interactive one?? Bcuz i did not really understand the meaning by reading the blog from MikeMirzayanov :) tnx for your help!

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

Which problem will be Interactive ?

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

I just finished my graduate entrance exam.It is so excited that I can join contest now.

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

Excited about the contest after a long break.

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

Interactive problem and 20 questions ..

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

can somebody help me with interactive problems

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

What interactive problem will be A,B,C?

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

I bet that 80% participants of this contest has no girlfriend. It's Christmas Eve!! Go hang out with friends!!

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

[deleted]

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

Can anyone provide link to the mirror website m1/m2/m3 I am not sure where to find it

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

Merry Christmas!!!

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

Good contest

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

feeling orz................

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

Problem statements are longer than my hair.

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

Hope for strong pretests. Merry Christmas!!

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

What is test 6 for D?

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

Am I the only one who over-killed C with segment tree and stuff and later realize it could have been done simply:((

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

I think problem C has some problem

Problem C- In statement: 2 <= n <= 1e5

Whereas just changing maxn=1e5+5 to 2e5+5 changed an RTE to AC

This should be rejudged with proper input files and first ac submission should be counted.

UPD5: sorry seems like, I've missed the announcement

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

How to solve D?

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

My approach for D, making at most $$$n+2$$$ queries: 67539477

First make two queries, one with 300 A's and the second with 300 B's to figure how many A's and B's are in the string, and therefore its length.

Notice that the edit distance from a string of length $$$k$$$ with all of the A's already placed is $$$n-k$$$ if and only if between no two A's we have more B's than in the hidden string (as then we could not make only insert-operations).

Using this, add B's before the first A until the edit distance doesn't decrease, then place the first A and repeat. Thus after the $$$i$$$th operation, we know a prefix of length $$$i$$$ of the hidden string. Thus after $$$n-1$$$ operations we know the entire string (as we know character counts). Including the first two queries, we make at most $$$n+2$$$ queries in total.

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

Can anyone help me why I am getting wrong answer for Div2 B1??? My approach- Sort the array. Check if you can buy all items till index 'i' supposing that you got i-1 item for free. 67533371

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

how to solve B2?

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

Can someone please explain why I got TLE in the problem Div 2-B2 ? Here is the link to my solution.Solution

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

1

6 17 2 6

0 0 1 0 0 1

7 6 3 7 10 12

Why should that give us 1 as an output? (Problem C-petya and exam) can someone help me?

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

Ultra fast system testing

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

Ok codeforces

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

E was a very nice problem. Among the best I've seen in a while. Too bad I had a silly bug in my code during the contest.

D was also nice. Hats off to the authors.

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

One of the fastest one I've ever seen...

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

D&E are realy good problems! ABC — stupid idealess problems!

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

Hello Codeforces, I didn't see the notification that the bounds for problem C were changed. As a result, I didn't notice the change for a long time. Would it be possible to unrate me? thanks!

My first correct sub with wrong bounds: https://mirror.codeforces.com/contest/1282/submission/67543972 Changed to 2e5: https://mirror.codeforces.com/contest/1282/submission/67558110

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

Am I the only one who did B by handling $$$K \gt = \sqrt{N}$$$ and $$$K \lt \sqrt{N}$$$ differently?

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

I'll post a screencast of the round within 12 hours. (I will also add those 5 minutes which I did not have enough to pass E).

UPD I hope the screencast will be available tomorrow at 07:00(MSK) by this link in good quality

UPD2 It is available

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

Approx 25% of all ACs of D ended up in fst, the edge case being bbbb...300 times. This was an obvious edge case and I do not get why you guys did not include it in pretests. Was this deliberate by any chance?

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

Test 67 for D?

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

Amazing system testing speed. Like

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

In problem C, I created 2 sets one to store hard problems mandatory time and the other to store easy problems mandatory time. Every time I check first problem in Easy problem + a and first problem in Hard problem + b and i take the one which Solved eailer. then I check if any problem should be solve in this time and I add it I only update the answer if the time at the end <= the total time of exam

Why this idea is wrong ? 67550974

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

Checker for D is incorrect. This solution https://mirror.codeforces.com/contest/1282/submission/67555058 still outputting things after getting 0 as response for the test "b" * 300, but I got incorrect hacking attempt on this one.

Hack is here https://mirror.codeforces.com/contest/1282/hacks/603027

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

Good evening everyone! Help me please understand what am I doing wrong on the second problem, so for the input (n = 4, p = 9, k = 2) and the numbers { 2, 3, 4, 5 } the expected output is 4, mine is 3. Thanks in advance!

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

Can someone tell what's wrong in this solution of D? 67559495

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

How come the pretests for D didn't include a single string with max length? It seems the longest string in the pretests had only 17 characters.

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

Can not understand why let $$$O(k^2)$$$ solution pass B2 pretest.

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

Hello. Please AdvancerMan could you help me understand why 67555899 got WA. The problem is that when I run locally the 5th case it returns the correct spell.

Thanks in advance

  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится
    This is your output

    Check how you calculate the edit distance.

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

I didn't submit because i couldn't solve Div2-B1. And i couldn't solve B because I kept thinking offer had to be applied once. I really think the setter should have clearly mentioned that :'( . Looking forward to next contest

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

can someone explain how to solve C?

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

I am getting WA for Problem D.

The checker says I printed an empty line (" ") which not acceptable , but my code doesn't print any such line.

Here it it : My Submission

Thanks in advance!

UPDATE : Resolved! :)

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

Awesome problemset, super fast system testing and rating change -> In a word a nice contest!

This contest is also exiting for me, because I found my mistake in code for problem C last minute and submitted 30 seconds before the contest ends and it got Accepted, and became blue after a long gap.

Thanks for the nice contest!

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

div2 b is similar to house robber but cannot solve in the contest :(

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

For a second I thought I can't solve B2 so i went for naive approach in B1. after writing some stupid long worthless code i tried B and solved it much faster and with less lines of code.Should have just sticked to B2.

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

My solution for D got AC code. But it is wrong, because i write always n + 2.. Ok.. This solution on C++11 got RE code. Then this solution got RE too. Can anyone explain me, how is it working?

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

I don't understand the WA message wrong answer Line [name=s_8] equals to "", doesn't correspond to pattern "[ab]{1,300}" on D. I tested my solution locally and I am not printing any empty strings.

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

Shoudn't B2 be done this way?

sort the given array. maintain K lists of prefix sum of (i%k) indices only. Then find upper bound of p in these lists, return the max. of these upper bounds. Also add to these upper bounds, those gifts which still can be bought without any offers, after each upper_bound applied.

My submission is failing on 55th TC of 2nd test case. Can someone please help me with that? I am not able to get that particular test case, since it is not being rendered on CF.

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

    It is simple dp, where dp[i] is min money to pay for first i problems. Sort the goods by price.

    dp[i]==min(dp[i-1]+a[i], dp[i-k]+a[i])

    You can allways buy goods one by one, or choose at any point to buy k goods at once. Anyway, you allways buy the cheapest goods.

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

What strange problems this contest have. I felt upset from Problem B(1).

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

Problem D

Why if I do more than N + 2 requests (exactly 1000 times) "aabba" it passes 1st test? link. I guess that checker counts only unique requests, not the actual number of requests. My solution was making N + 3 requests (while I thought it was N + 2) and I was getting WA 5 the whole contest. I couldn't even think that the problem was with a checker :(

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

Anyone solve B with binary search..

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

Can anyone explain that why in this solution https://mirror.codeforces.com/contest/1282/submission/67533137 they use midb and the for loop for midb, with using only mid as in normal binary search answer fail on first case on test case 7.. Pls explain why midb is necessary.

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

    For binary search, your function needs to be monotonic, and this is not the case when you just use the "mid" approach. In the seventh case, note that it costs 7 to get three things, but 3 to get four.

    4 6 4
    3 2 3 2

    This is caused by being forced to buy mid%k items individually. The "midb" approach compensates for this by "rounding up" and checking the answer for the next multiple of k. This works because the cost for all values between mid and midb is greater than or equal to the cost of mid and the cost of all values larger than midb is greater than or equal to the cost of midb (proof left as an exercise).

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

How would the solution for D be affected if the strings were not binary? Let's say you had 26*(n+2) queries. Would the same technique work? If not, what would change?

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

How this test case in 1282C - Petya and Exam is getting the answer as 1. Shouldn't it be 0?

6 17 2 6
0 0 1 0 0 1
7 6 3 7 10 12
»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

WA because of integer overflow hurts again

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

In Problem C, second Testcase, the 12th test is

2 13 3 6
0 0
2 0

Since mandantory times are 2 and 0, and a==3 I would expect the answer to be 0, no problem can be solved in time, since the first solved problem is at t==3, that is after 0 (and 2).

But grader says answer is 2, so both problems should be solvable in time.

What did I get wrong, can somebody explain? submisson

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

This was one of the worst rounds I've done. I hope none of real coordinators would allow problems ABE in the contest. D was nice, but forbidding to ask queries longer than maximal string is a bit silly. Still, having one nice problem is not enough to make a round out of it. I like when new people are starting in problemsetting, but next time ask for an actual coordinator who is willing to say that your problems are bad.

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

What is the reason for having an upper bound on the size of string query you can ask?

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

i solved E with topological sort . Is there any other way (for finding the vertices permutation)

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

Can some one help me find the mistake in my submission 67570438 for Problem D.

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

When you think your approach is wrong but after contest you realize it is just -1 which gives causes WA, it hurts.

1

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

Master as christmas present!

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

Hello everyone,

I have tried to make video solution for the first four problems of Codeforces Round 610 Div. 2, hoping to help people understand the problem and what was my approach for the same. Please do like the video and do subscribe for more such content.

Video playlist: Codeforces 610 Div2 Video Solutions Playlist

Separate links are as follows: A B1 B2 C

Happy Coding

Divyanshu Kumar

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

Using google translate for the editorial makes it super hard to understand :(

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

in problem B1 how can (4 9 2 ) 2 4 3 5 results into 4. its impossible to buy 4 items with 9 coins