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

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

Спасибо за участие!

1181A - Chunga-Changa придумал vintage_Vlad_Makeev, а подготовил achulkov2

1181B - Split a Number придумал Endagorion, а подготовил manoprenko

1181C - Flag придумал и подготовил budalnik

1181D - Irrigation придумала Елена Владимировна Андреева, а подготовил ch_egor

1181E2 - A Story of One Country (Hard) придумал voidmax, а подготовили её voidmax и alexey_kuldoshin.

И теперь разбор:

Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Разбор задач Codeforces Round 567 (Div. 2)
  • Проголосовать: нравится
  • +84
  • Проголосовать: не нравится

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

No doubt E is very cool, thank you for this round!

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

It is very convenient to use Python to solve B but I'm not good at it. Learning several different languages seems important.

Anyway, thank you for your amazing problems!

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

    I used python to solve the problem But I'm stuck in the case when the leading zeroes come. Can someone help me with that ?.

    My submission is 55661488

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

      Hey, there are two things you can do over here.

      1) Slice at the middle, then slice at the nonzero number to the right of middle & similarly to the left. (As explained in the editorial)

      2) Since you use python you can partition at every possible place and check the right half doesn't start with zero. And finally, return the minimum sum of both halves.

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

Does there exist a stack based solution to 1181C, similar to how SPOJ — HISTOGRA is done? Both questions look very similar, hence my question. I tried but couldn't figure out anything.

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

    the problem is that you have here various color so you have to go through a series of corner cases and handle a lot of if-else to do stack implementation. I don't know but it should be really complex if it exists.

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

It seems that there's another solution for problem D, without tree data structure. https://codeforces.me/contest/1181/submission/55650482 Could someone explain how it works?

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

Can Anybody explain this statement for Problem D :- "If we subtract from k (the query parameter) the number S of cells painted in previous rows, then we simply need to return the (k−s)-th element in this set." Thanks in advance.

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

Could anybody explain what the solution for Problem E(hard version) works? What's the meaning of Let's sort rectangles using all 4 possible sortings. And let's iterate over all this sortings simultaneously. and the sentences after it? Thanks a lot.

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

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

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

Very interesting contest and hard at the same time! Congrats to the organizers. Can you please put solutions for every problem? The problems are well explained without a doubt, but it will be very helpful.

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

can some one explain how to solve problem C in details

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

Who know how to solve D by using segment tree? Why not use priority_queue?

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

    We understood, that the next olympiad will take place in the k-th city(we will assume, that cities which can organize the olympiad sorted by their number). now we will talk about segment tree. Vertex in this segment tree will responsible for how many cities form l to r can organize the olympiad.Consider you are in the vertex v, and the olympiad will take place in either of cities from 2 * v, or 2 * v + 1.If the value of the vertex 2 * v larger than k, it means that there is no point in looking for k-th city in vertex 2 * v + 1.In other case we will check vertex 2 * v + 1, instead of vertex 2 * v.

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

hardes part was implementation, please more constructive and greedy problmes rather than implementation. in B

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

Can anybody explain me the editorial of Problem C ? I am getting a hard time to understand it.

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

What is the idea behind this implementation of D(without using tree data structures). https://codeforces.me/problemset/submission/1181/55665170

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

Can Anybody explain this statement for Problem D :- "If we subtract from k (the query parameter) the number S of cells painted in previous rows, then we simply need to return the (k−s)-th element in this set." Thanks in advance.

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

for problem B what would be output for the following input

6

100001

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

I did problem B with C++. I think it works perfectly. But I'm getting wrong output format for test case 9. Here is my submission 55812911. Can anyone help me out, please?

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

thank you for your great contest ! hope more contests like this

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

enjoyed this contest thank you !

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

Could explain in more details the solution to problem D ?

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

    After several long long hours of reading code of hundred of people, I finally have figured it out. You can read the easiest-to-understand-code-for-me I have found here .

    I think you should try as hard as possible to understand it (draw the segment tree, run that code with some test and try to understand it) as you will learn a lot when you yourself can figure it our on your own.

    But if you still struggle with it, just message me I will explain it for you.

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

Some confusion about Test case 3 of problem E

First I calculate the total area of all rectangles the result is area = 999999208300485319 Then I found the target boundry which is Left = 0,Right = 999999997,Down = 3,Up = 999999998 However the target area is not the same as total area But the answer is YES. Why? Am I wrong?

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

Hello, For problem E

I have submit my solutions several times and cannot get accepted, I doubted there is something wrong with the standard program.

Here is one case.

2

1 1 2 2

3 1 4 2

The answer for this case should be NO. However the accepted solution returns YES.

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

В таске D для решения подзадачи, где нужно искать во множестве i-й по порядку элемент, написано, что это можно сделать при помощи дерева отрезков. Мог бы кто пояснить, как это делается?

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

In problem E2, can anyone come up with a case where you can only cut off $$$O(1)$$$ rectangles each recursive step, causing the $$$O(n^2)$$$ solution for E1 to fail? I couldn't find such a counter case so I submitted my solution to E1, and got TLE as expected.

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

In problem E, the sentence "if we replace set of rectangles with its subset, it only can make better." is intuitive but very much far from obvoius. The editorial didn't give any alternative characterisation of being a nice subsets that make this clear.

A good cut is a cut that does not cross any given rectangular area.

Here is a proof: Use strong induction. Suppose we have a working plan that makes A as the first cut. We have another a cut B. We want to obtain a working plan that starts with the cut B instead. If A and B are in the same direction, then we B must still be a valid cut in one of the parts after A, so we can apply induction. Otherwise, if the cut A produce two parts X,Y, then observe that B is still a good cut with respect to X and Y, so we can use strong induction, and obtain plans for X and Y that starts with B. We can now merge these two plans into one plan that start with B.