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

Автор Shayan, 23 месяца назад, По-английски

Hi,

Here is the video editorial of all the problems of Educational Codeforces Round 167 (Rated for Div. 2). I hope it helps.

1989A — Catch the Coin

1989B — Substring and Subsequence

1989C — Two Movies

1989D — Smithing Skill

1989E — Distance to Different

1989F — Simultaneous Coloring

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

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

I cant understand d, can someone explain the approach

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

    First,we can consider that each $$$c_i$$$ is independant.So,we can calc the answer of each $$$c_i$$$.Then we calc their sums.

    Then,obviously,we can discover $$$i$$$ is important for us to use it if there is $$$j$$$,$$$a_j\le a_i$$$ and $$$a_j-b_j\le a_i-b_i$$$。Because we can use $$$j$$$ to replace $$$i$$$ and we can save more objects.

    Therefore,we can let $$$d_i=a_i-b_i$$$ and sort $$$(a_i,d_i)$$$ in the order of $$$a_i$$$.Then a useful $$$(a_i,d_i)$$$ means there isn't $$$j \lt i$$$,$$$d_j\le d_i$$$.So we can record $$$k=\min_{1\le j \lt i} d_j$$$,$$$d_i \lt k$$$。

    Like this:

    [submission:267715465]

    Then,we use dp algorithm to solve it. Let $$$f_i$$$

    is the answer that we have $$$i$$$ objects.

    Obviously,$$$f_i=f_{i-d_j}+1$$$,$$$j$$$ is the maxnum $$$x$$$,$$$a_x\le i$$$.

    Because $$$a_i\le 10^6$$$,we only calc for $$$i\le 10^6$$$.

    For $$$i \gt \max a$$$,we can reduce it to $$$i-kd$$$ by use $$$max a$$$.$$$k=\lfloor\frac{i-\max a}{d}\rfloor+1$$$

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

i tried storing the increasing differnce of a[i] — b[i] (and consecutively increasing a[i]) in maps but am getting TLE.Can someone tell me why my time complexity is getting f-ed.Can someone also tell me the optimizations.my submission :((

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

i hoper they will add text tutorial too

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

I have a doubt in my submission for problem B where I iterate on the string b and whenever I match a character of it with "a" i increment the ptr j of b and then increase the variable cnt. Finally I print the answer as a.size + b.size -cnt . But it fails somewhere, can anyone help me give a case where my solution fails or the problem with my approach?267685947

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

Video editorials is a great addition to codeforces, I hope we normalize it. However text editorials is much important than video editorials so please don't stop doing it.

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

can anyone tell me in problem B answer is n+m-longest common subsequence of both strings? is it correst

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

267826797 ques b) can anyone why its not giving right output or on which test case it fails

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

Nice try! However, not all users on CodeForces are good at English, they may find it difficult to understand this video. May the authors upload text tutorial too?

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

    The authors are gonna upload the text tutorials. Not uploading the text tutorials in favor of video editorials would be a retarded decision. Video tutorials are just like a bonus for whoever learns better by watching.

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

But Shayan got TLE in his submission 267715088, can we get updated tutorial for D?

upd: sorry, he got WA

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

Disappointing judging for the D problem, I had made an O(n) submission without including

ios_base::sync_with_stdio(false); cin.tie(nullptr);

and it didn't pass due to TLE, but after including this block and submitting an O(nlogn) code, it did.

I am assuming normally optimizations like these should not be a factor but due to the tight constraints, they resulted in TLE.

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

I hope they add the Text editorials soon

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

[deleted]

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

[deleted]

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

Weak test cases in D. But anyway, good round indeed.

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

can someone tell me why i go wrong answer at test 2 267864473

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

    Your idea is incorrect because whenever you get that b[i] == a[j] you are assuming that taking that a[j] will give you the best answer that isn't necessarily true. For example, there is this test case:

    1 bba abb

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

This solution for problem D is getting a runtime error on the 9 th testcase. I can't seem to find the issue. Can you guys help!

https://mirror.codeforces.com/contest/1989/submission/267869614

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

Nice problems

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

Solution of d provided in video got wrong answer on test case 21

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

In problem D, I am getting Runtime error on test 14. Not able to figure out the issue. Pls someone help. My submission: 269094484