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

Автор isaf27, 7 лет назад, По-русски
Tutorial is loading...

Решение жюри: 54047380

Tutorial is loading...
Решение жюри: 54047416
Tutorial is loading...
Решение жюри: 54047456
Tutorial is loading...
Решение жюри: 54047487
Tutorial is loading...
Решение жюри: 54047513
Tutorial is loading...
Решение жюри: 54047561
Tutorial is loading...
Решение жюри: 54047626
Tutorial is loading...
Решение жюри: 54047665
Разбор задач Codeforces Round 559 (Div. 1)
Разбор задач Codeforces Round 559 (Div. 2)
  • Проголосовать: нравится
  • +62
  • Проголосовать: не нравится

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

Большое спасибо за раунд, особенно за 4 задачу, получил большое удовольствие, придумывая конструктив. И вообще, люблю раунды на идею, а этот именно такой, у меня в 4 решённых задачах по 10 строк кода. Побольше бы подобных соревнований!

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

В разборе Div1.B, сказано, как решать, и показано, почему это будет правильным ответом. Но куда интереснее понять, как до этого можно было додуматься? Какие рассуждения должны были привести именно к такому виду ответа и такому $$$\texttt{a}$$$?

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

Hard B, trivial C and D, cool E. And I completely understand that it's easy to misjudge the difficulty of B.

I don't like limits in F and I want setters to take some things into consideration in the future. Here, the jury solution (attached in the editorial) takes 40% of TL what is quite tight, especially considering the fact that it does all modulo efficiently — avoiding the % operator if possible, doing if(x >= MOD) x -= MOD instead. You should do that in brute force solutions and make sure they still don't pass, but the author solution shouldn't be written very efficiently. Remember that participants won't necessarily implement everything in the same way. Do you really want to penalize them for writing a code that is twice slower? And let's remember about a bit slower Java, though maybe it wasn't an issue here — because modulo was the heaviest operation. TL 8-10s and ML 512MB look much better to me (the author solution takes 118MB and it would barely pass after replacing ints with long longs).

Tight limits can be forced by a dangerously fast brute force and maybe everything was chosen as good as possible in this problem, I don't know. Even in that case, I think that my post still can be of use for future setters.

Remember this: limits should be chosen in such a way that naive solutions don't pass. If this condition is satisfied, it's great to make TL to be much much more than twice the running time of your solution.

And limits in C were too tight as well. Reading $$$500\,000$$$ numbers and possibly doing something with a set or a segment tree? That takes some time, especially in slower languages. It's good if easy problems are solvable with Python. Just make TL to be 2s or 3s. Why not?

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

can anyone explain me div 1 C with more detail how to solve this with set/segment tree.

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

Можно разбор div.2 1159C — Праздник и конфеты, плез

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

When will the editorials of rest of the problems be translated to english?

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

Please translate

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

Can anyone please explain 1159 C the party and sweets?

if the testcase is the following

4 1

1 2 3 4

5

then shouldnt the answer be -1?

how is it possible for the boys to give 1,2,3,4 chocolates, and for the girl to also get 5 chocolates from some boy

Thanks

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

UPDATE: Answered here

In Div2E/Div1C.
Does anybody know why this 54049263 gives MLE? When I change stack to set I get AC in this 54047364

My Approach: Construct a directed graph where edge (u,v) means a[u] < a[v] and then do topological sort on that graph.

The way I construct it is if nxt[i] = j that means there is an edge(i, j), also there is an edge between all elements [i+1, j-1] and i since all of them must be less than i. I only keep track of the least previous element.

Here's an example where ix, jx means nxt[ix] = jx:
i1 i2 i3 ... j3 j2 j1. Edges are (i1, j1), (i2, j2), (i3, j3), (i2, i1), (i3, i2). I don't add (i3, i1) since it's redundant.
In a case like i1 .. i2 .. j1 .. j2 In the MLE submission I exit immediately and say that it's impossible. In the AC submission with set I let the topological sort handle it.

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

isaf27 why no english editorial ?

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

Where could I find the solutions in English pls

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

English solutions please!!

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

Can anyone help, what is 'l' in the explanation of D above?

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

Now editorials in English are available, sorry for waiting. If something isn't clear you can ask in comments.

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

in problem c (The Party And The Sweets) in test case 1 what is wrong in this ans: b1- 1 1
b2- 3 4
b3- 1 1
ans=11 ??

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

Div2D: Editorial is not helpful at all.
You explained the pattern to generate the answers.
But how to come up with that kind of pattern in first place.
Please share some ideas in what direction to think for problem like that to come up with patterns like that. Stating formula and why formula works is not helpful at all.

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

    To solve this problem it's better to solve some cases, for example:

    1. k = n, it is an obvious case
    2. k = n — 2, I think it isn't hard to guess, that 0101010101 is the correct example
    3. k = n — 4. This is the hardest case. But if you will think for some time, checking some examples, you will guess, that periodic string is correct

    And after the last case, it's easy to guess the pattern. I think it is a good way to solve this problem.

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

About Div2-D, condition on the assumption of periodic a and minimum unique length k, I got

$$$ a \gt = (n - k + 1) / 2 $$$

doesn't it means the period not unique but have a lower bound? But I failed on program checking.

And when the parity of n and k not same, even the lower bound of a is wrong. Why is that? Really doubtful.

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

I think the editorial's proof is overly complicated for Problem E. We can just prove it by induction. (construction from the right side)

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

Does the checker code of Div1B/Div2D use string hashing? I think there is some (very small) probability of failure. Is there any deterministic checker?