Shayan's blog

By Shayan, 17 months ago, In English

Note: The text editorials will be provided by the authors of the round. This video tutorial acts as an additional resource for those who prefer video over text, not as a substitute for the text editorial.

2050A — Line Breaks

Video

2050B — Transfusion

Video

2050C — Uninteresting Number

Video

2050D — Digital string maximization

Video

2050E — Three Strings

Video

2050F — Maximum modulo equality

Video

2050G — Tree Destruction

Video
  • Vote: I like it
  • +18
  • Vote: I do not like it

| Write comment?
»
17 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

im ngl if you managed to tle on this you lowkey deserve it just take the extra 10 seconds to optimize

  • »
    »
    17 months ago, hide # ^ |
    Rev. 3  
    Vote: I like it 0 Vote: I do not like it

    I wasn't trying to be rude I'm just actually curious as to why it didn't work. I am doing these questions not in the contest but in my own pace out of interest. Idm that it was tle'd but it's more or less trying to understand my solutions time complexity. My mistake was I didn't return 0 but -1 it was a silly mistake.

    • »
      »
      »
      17 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      oh sorry didnt mean to be rude, i just think that you should have extra complexity for no reason if its not any harder to implement or think about, but it seems you had another problem. happy coding!

»
17 months ago, hide # |
Rev. 5  
Vote: I like it 0 Vote: I do not like it

Any idea on why this submission is causing a TLE for Problem D: 295113992. Could it be due to the i-- part? I don't think i-- is causing tle because the purpose of --i is to find a "better" digit that can be brought forward. This ensures that for the current position i, the best digit is brought to the front before proceeding but we bring forward k elements we will not reconsider them in constructing better digit. So number of element that can be brought forward also decrease for a given n

  • »
    »
    17 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Firstly, this is D, not C. Secondly, I believe the TLE is from sorting (which takes nlogn) within the loop making

    n^2logn

    same story for skip

    • »
      »
      »
      17 months ago, hide # ^ |
      Rev. 3  
      Vote: I like it 0 Vote: I do not like it

      Lever So i-- is not an issue right? If I manage to optimize sorting part, the solution should work — not sure how but assuming ? I'm saying i-- is not a concern because, for example, If we're bringing forward 1e3 elements for each i, this operation will only be performed at most 200 times, given that n = max i.e. 2e5. For the first 200 iterations, we're bringing forward 1e3 better digits. After that, we can't repeat this process since there are no more elements left to bring forward.

      • »
        »
        »
        »
        17 months ago, hide # ^ |
        Rev. 2  
        Vote: I like it 0 Vote: I do not like it

        Yeah, you can do by

        Only open if stuck

        by doing this you dont need the i-- either

»
17 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Shayan Bro, is there any way to do problem D with a custom comparator and exchange argument? I tried but failed.

»
17 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hmm