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

Автор cdkrot, история, 7 лет назад, По-русски

Всем привет!

Завтра состоится всероссийская олимпиада школьников для 5-8 классов имени Келдыша. Удачи всем участникам! Олимпиада проходит под чутким руководством московской методической комиссии в лице GlebsHP, ch_egor, Endagorion, vintage_Vlad_Makeev, Zlobober, meshanya, cdkrot и, конечно, Андреевой Елены Владимировны.

Мы рады представить раунд codeforces на основе задач олимпиады. Это будет Div. 2 раунд, который состоится в 16.06.2019 12:35 (Московское время). Возможно, вы уже и раньше участвовали в раундах на основе олимпиад, подготовленных московской методической коммисией (раунды 327, 342, 345, 376, 401, 433, 441, 466, 469, 507, 516, 541, 545)

Задачи этой олимпиады были подготовлены voidmax, alexey_kuldoshin, ch_egor, budalnik, achulkov2, manoprenko, vintage_Vlad_Makeev, Endagorion.

Также спасибо KAN за помощь с организацией Codeforces версии соревнования и MikeMirzayanov за системы Codeforces и Polygon.

Также хотелось бы поблагодарить компанию Tinkoff и лично Татьяну Колинкову за организацию онсайт соревнования.

Желаю удачи!

Разбаловка: 500-1000-1500-1750-(2000+750)

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

Div. 2:

  1. thecodinglizard
  2. baIuteshih
  3. Cong1500DanPaiXia0
  4. Yelan
  5. HatsuneMikuo

неоффициальный Div. 1:

  1. Radewoosh
  2. isaf27
  3. chemthan
  4. uwi
  5. kmjp

Разбор будет скоро опубликован.

upd. Опубликован разбор.

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

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

Наконец-то смогу показать этим пятиклашкам, кто здесь главный!11!!

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

Если это действительно Div.2, то не завидую 5-6 классам. Удачи вам!

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

    Главным образом олимпиада ориентирована на 8й класс, но мы рады видеть и более младших школьников :)

    А ещё школьникам чуть проще чем вам, потому что у них есть возможность сдавать решения на частичные баллы.

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

      А ещё школьникам чуть проще чем вам, потому что у них есть возможность сдавать решения на частичные баллы.

      А, кстати, зачем это так? Меня зимой школьник шокировал рассказом, как получил за явную лажу более половины баллов, потому что, с его слов, баллы соответствуют доле тестов, которые проходит программа. Я сейчас смотрю условие этой самой задачи 2 — там вроде как расписаны какие-то разумного вида подзадачи (k≤1000, k≤10⁵…), но речь была о программе, неверной для самых разных k, начиная с 12.

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

An unusual start time!!! Hope it give me an unusual experience .

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

An unusual start time!!! Hope it give me an unusual experience .

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

я могу написать этот раунд, если я участвую на олимпиаде Келдыша?)

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

Ind vs Pak CWC 2019 at 3 pm IST . Hard choice for Indian Cricket Fans to participate in this round.

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

    for dislikers: soccer world cup final attracted 1.6 billion viewers while today's India vs Pak crikcet match expected to attract 1.5 billion viewers..so dislikers do respect other's choices as well.. although i will be going for the contest :P

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

is it rated for everyone?

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

Who is Keldysh?

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

The time is very very very friendly to Chinese

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

Clashes with India Vs Pakistan :-/

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

..для 5-8 классов..

Как жаль, что я 9-классник с интеллектом 4-классника ._.

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

Glad to see vintage_Vlad_Makeev and vintage_Vlad_Makeev working together

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

Another round I will miss because of university exams :(

These stupid exams came when I am that close of becoming master, My rating in 2080 :(

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

please How many problems were prepared

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

May I know how many problems are there and if the solution will be pubished?

Sorry for my poor English :) Thanks

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

Minor clarification, I'm new around here. Does All-Russian mean the questions will be in Russian only?

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

what is the score distribution??

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

Is it a rated contest?

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

I just hope it won't be a mathforces

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

Сколько задач будет на раунде?

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

Can you let me know how many problems are there and what the score distribution is?

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

hoping for specialist. prey for me.

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

Codeforces round vs India-Pakistan WorldCup match.Let's see what Indians prefer.

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

How does hacking work when there are two (easy and hard) versions of the same problem? They have to be connected somehow because somebody would be able to solve easy with brute force, lock it and check codes to find some which work even for hard version (and learn how to solve it).

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

задачи слишком адские для див2. участники всероса и участники республиканской из моих друзей не могут больше двух(!!!) сдать. слава богу, что я учусь не в москве

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

How to solve C ?

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

Hard, but interesting. Thanks!)

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

So hard.55555~~~

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

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

So hard, feel like I am a retard

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

"nice but hard to implement" problems !!!!

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

How to solve D?

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

hard problem for B

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

Where does my solution for problem C go wrong: code

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

let me summarize. B = C, C = D. right?

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

Light-speed system test, I love it! WOW!

Upd. It only used about 20 minutes! REALLY COOL!

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

I wrote an O(nlogm+mlogm+qlogm) solution to problem D by merging some segment trees link. I thought that would pass under a TL of 2.5s for n,m,q<=5e5. However, it got a TLE. I tried all methods I know to make it run faster but it always gets TLE on pretest 10 or 11. I'm just wondering why a nlogn solution gets TLE. Is the constant of my code too big or a solution with a better complexity(O(n) maybe?) exists?

Sorry for my poor English.

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

How to solve E?

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

    Let's solve the problem recursively. If $$$n=1$$$, the answer is "YES". Otherwise, we have to find a horizontal or vertical line which separates rectangles into smaller ones without intersecting any of them. If no such line exists, the answer is "NO". If it exists, we can greedily assume that it was the line of the last merge and solve problems recursively.

    So, $$$O(n^2)$$$ (maybe $$$O(n^2 \cdot \log(n))$$$) is easy. How to speed it up? We'll try something like "smaller to greater", but in reverse. As we'll split the problem into two smaller ones, we can do it in complexity $$$O(size\_of\_the\_smaller\_part\_after\_the\_split)$$$ (possibly multiplied by $$$O(\log(n))$$$) and the overall complexity will be good. The problem is that we don't know if the line that we are looking for will be horizontal or vertical and we don't know if it'd be closer to the beginning or to the end of the list of sorted rectangles.

    The solution is to try every option at the same time. Maintain $$$4$$$ sets, one for each possibility, go through each of them and if you'd find a good line, stop here, split each set into two smaller ones and the complexity will amortize.

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

How to solve D? can you help me.

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

So I will wait for Div.3 to raise my rating xD

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

B was incredibly time-consuming in my opinion. I hate strings, it took me 150 lines of code to solve B and I couldn't even submit it in time. After half an hour of coding B I realized that there's like a 100k digits and I can't sum the string as numbers but as strings, so this was my first time ever doing this and i hate it, I hate strings, they're just tedious things that are very easy to mess up because there's so many things that you need to do with strings to manipulate them that its very easy to mess up the code and then debugging takes a lot of time. And I unknowingly solved A within 10 minutes but because I forgot about long long, I thought that there was a math error in my code, so I just skipped A.

At least I learned something..

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

About problem B. The complexity of adding 2 strings is O(max length of 2 strings). I added 2 trings with max length <1e5 three times but I got TLE. I couldn't solve B. Can anyone explain? Thank you very much.

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

Am I the only person who felt this contest was boring, with lengthy statements and implementations?

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

    I'm not rated high enough to give an expert opinion about this contest, but from my perspective, this was a pretty lame contest. One or two more sentences in each problem to clear some stuff up would go a long way to helping us solve these problems, I feel like some of the information in the tasks were withhold from us just so the tasks would be harder to solve.

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

Do B have weak test cases

I found many codes which fail on

5 10100

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

Fast Testing...Btw i did not like B at all

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

power of system test -> 1200 — 3086

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

0 doesn't have leading 0. but in problem B it have !!!!

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

    From the problem statement: "To solve the issue, Dima decided to split the strip into two non-empty parts so that each of them contains a POSITIVE integer without leading zeros." 0 isn't a positive number.

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

very hard and boring and just implementation

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

B is not fair for C++ ( and other programming languages which do not have bigint library ) programmers.

I solved B using python in 40 lines while C++ needs 100+. ps. sorry for my poor English...

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

What is C test case 20? Anybody else fail on that case?

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

E1 can be solved by simply dividing, now the problem is how to get an $$$O(n \log n)$$$(maybe) algorithm to solve E2.

Pls help me.

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

    Let’s optimize dividing. When we are finding cut, we do it in O(number rectangles in one part). Let’s go in 4 directions in one time and cut min part.

    Also, when we found cut, we should erase one part and keep correct orders in 4 directions. We can do it using stack or list.

    This solution works in O(n log n). (We gave here TL from the original contest, where you can solve this problem with python.)

    (Sorry, more details will be in editorial)

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

    hint: for a subset of rectangles $$$A$$$, you probably have some function $$$solve(A)$$$ which splits $$$A$$$ into $$$B_1, B_2$$$ and returns $$$ solve(B_1) \text{ } AND \text{ } solve(B_2) $$$. The problem is that this splitting takes $$$O(|A|)$$$. Can you make it take $$$O(min(|B_1|, |B_2|))$$$ instead (with some log-factor)?

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

Щас бы давать длинку на контест.

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

I had a mistake in adding long numbers. Very irritated now.

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

А онсайт результаты можно где-нибудь увидеть?

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

Could anybody please tell why this submission doesn't work for problem C? https://mirror.codeforces.com/contest/1181/submission/55645536

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

Too bad. I can't solve more than 2 problems in a contest that's meant for school students.

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

Когда В на длинку:

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

Time to become Expert!

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

Мы немного задерживаемся с публикацией разбора, в связи с проведением онсайт соревнования.

Но вы можете пока посмотреть презентацию.

upd а вот теперь есть разбор

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

Problem A has 16 tags now. :O

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

Next Div-3 contest is converted to the div-2 contest. lol...

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

There is change in figure of problem C,but no announcement of it -_-

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

Got tle on D, put #pragma GCC optimize("O3") and ios_base::sync_with_stdio bla bla bla and got AC with 889 ms.... damn it hurts...

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

Any hints for problem C? (not in a complexity of 1e9)

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

    n²log(n)= 660000 if you use segment tree to get how much you can extend the flag

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

    Build 2d-prefix array for each character, then consider each $$$(i,j)$$$ as the bottom left corner of the flag. Binary search the heigh of one stripe — the maximum value of $$$h$$$ such that all characters from coloumn $$$j$$$ in range $$$[i, i + h)$$$ are equal. Then check wherher all characters from $$$j$$$-th coloumn in ranges $$$[i+h, i+2h)$$$ and $$$[i + 2h, i + 3h)$$$ are equal. If not — $$$(i,j)$$$ can't be the bottom left corner of the flag. Otherwise use binary search again to find the maximum value value of $$$w$$$ such that all characters in rectangles $$$[(i,j), (i+h-1, j+w-1)]$$$, $$$[(i+h,j), (i+2h-1, j+w-1)]$$$ and $$$[(i+2h,j), (i+3h-1, j+w-1)]$$$ are equal. (Here $$$[a,b]$$$ means the bottom left and top right corners of the rectangle). There is exactly $$$w$$$ possible flags having cell $$$(i,j)$$$ as their left bottom corner, add this value to the answer and procced to the next cell.
    Here is a bit prettified version of my solution: https://ideone.com/dKdcpu

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

    For each j from 1 to m, we count number of submatrices which left most vertices are in column j. To do so, we divide column j into a list of segments of consecutive characters, for example: 'aabbbcd' -> (1,2) (3,5) (6,6) ('aabbbcd' is characters of column j)

    For each 3 consecutive segments, let x, y, z be lengths and c1, c2, c3 be single characters of 1st, 2nd and 3rd segment. For above example, with segments 2, 3, 4, we have: x=3, y=1, z=1, c1='b', c2='c', c3='d'.

    Now we can get the start of correct flags here if c1 != c2, c2 != c3, x >= y, y <= z. Then we can do binary searching to find maximum length which we can append from the start to get a correct flag. Assume it's d, if d = 0 then it means we can't append anymore from the start, and result += 1 (the start). So result += d + 1.

    When do binary searching, we have to check whether all three strips have only one character. To do so, we can precalculate 2d prefix sum of 26 characters.

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

    We can do it in O(n*m)

    Hint : Consider only flags of width one.

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

Could someone please help me figure out what is wrong in the 9th test case in problem B. Here is my submission 55649908. Thanks in advance.

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

Weak test cases for problem B

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

Had a screwed up contest, when will the editorials be out?

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

Editorials?

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

Why did this 55636748 get accepted when it is failing for test cases like

2
55

and

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

Can anyone help me with a test for problem B? This is my solution and i can't find where the bug is https://mirror.codeforces.com/contest/1181/submission/55659680

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

How could one prove the corretness of greedy splitting in E?

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

    Let’s look on some correct splitting. What changes then we cut some line? Some next cuts will split set of rectangles in two parts with empty one. All those cuts should be deleted. After deleting correctness doesn’t change.

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

      Please, tell me if i understand well.

      If we look at some correct splitting, we can add this extra horizontal or vertical line, and then some regions may be empty ( without castle ). We can always merge this regions with their neighbours by deleting some parts of existing lines in order to achieve one castle in one region. Is this correct, or am I missing something?

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

        You are absolutely right!)

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

          Ok, thank you for your reply.

          There is actually one more thing im not sure about. After doing this operations shape of some regions may change. How do we ensure that it is always possible to merge them one by one ( finally achieving the whole rectangle ). Some of them will change they size so why is it always possible to obtain correct soltuion? Some of the initial mergings may be not available now.

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

Can you guys help me to debug my solution to problem D? I used a treap to update and find the kth smallest. Code : https://mirror.codeforces.com/contest/1181/submission/55663264

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

Nice contest, but way too heavy on data structures. My beginner students were struggle a lot.

Even B uses big integers.

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

Could someone explain why is it that in Problem C 10^9 operations also get accepted. Shouldn't that give TLE. Thanks in advance.

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

getting runtime error on test case 10 in problem D. https://mirror.codeforces.com/contest/1181/submission/55675351

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

Thank you for opening the contest.

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

When a new girl enters the class. Boys be like: