MikeMirzayanov's blog

By MikeMirzayanov, 3 years ago, In English

Hello.

Here's a small improvement for posts and comments. Likes can now be specified in their markup. Maybe this will be useful for organizing some kind of polls or collecting feedback.

Here are some examples:

Markup
Use square brackets instead of round
Result
Simple likes widget
(likes:1)
Same keys means same likes widgets
(likes:2)
(likes:2)

Same keys and different groups can be used for exclusive choices
(likes:3,option1)
(likes:3,option2)

Yes, I know that this feature can be improved. I would prefer that we try to use it a little and understand what exactly is missing the most. Maybe we need to implement the fully functional polls.

Let's do a small survey using the new feature.

  1. What is your age range?

    • under 16:
    • 16-20:
    • 21-25:
    • 26-35:
    • 36+:
  2. Tabs or spaces?

    • tabs:
    • spaces:
  3. Have you had covid??

    • yes:
    • no:
    • I don't know:
  4. Lately, there have been a lot of meaningless blogs on Codeforces. Is it worth strengthening measures to fight against them?

    • yes definitely:
    • rather yes, but not necessarily:
    • rather no, I read some of them:
    • no definitely:
  • Vote: I like it
  • +745
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
Rev. 2   Vote: I like it +68 Vote: I do not like it
»
3 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

Please change "you" to "I" in last point : "no definitely, you just don't understand them". Thanks.

»
3 years ago, # |
  Vote: I like it +59 Vote: I do not like it

Can we please have an faq section which is more visible/relevant ?

It's annoying how after every contest there's a comment about java code giving TLE due to Arrays.sort() and unordered map giving TLE.

One feature I'd like to see is wiki section where the many educational blogs written on Codeforces can be seen. Currently whenever I have to see/read about a new topic (example -> segment tree) . I have google segment tree codeforces . This shows all the segment tree related blogs on codeforces which include many useless ones. The blogs would be chosen based on upvotes or any other reliable source.

Also thanks for the features.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +175 Vote: I do not like it

    So much support for a list/catalog/wiki of tutorial blogs. Only a few days ago I found out that I had missed an interesting blog about convolutions because I happened to not check the blogs during the 24 or so hours this blog was in Recent Actions. It would be awesome if I could just open the list of tutorial blogs and start reading up on the first thing I don't know. Also as someone who sometimes writes educational blogs it's kinda demotivating to see my blog just disappear into the void after it gets buried under "please debug my code", "rule about third-party code is changing", announcements of old rounds and "someone cheated on Telegram".

    The only issue is preventing this place from being overrun with spam and low-quality tutorials. My suggestion is to simply allow only masters and above (or whatever rating limit feels appropriate) to add blogs to such a page.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it +39 Vote: I do not like it

      I've been facing these issues myself as well. You need to constantly monitor recent actions for high quality blogs, lest it gets flooded with spam blogs. The main issue seems to be the fact that "blogs" being the only top-level communication unit forces them to perform all sorts of functions, and useful stuff for some purposes is just spam for other purposes.

      Adding a page with links to good tutorial blogs would definitely be a good idea (and it would be great if it could be kept persistent with all history rather than just a sliding window like recent actions). Perhaps this can be done as a separate section on the EDU page as well, idk.

»
3 years ago, # |
Rev. 2   Vote: I like it +77 Vote: I do not like it

Now I can beg for likes without begging for contribution:

I request likes

BTW the widget is displayed as usual text when previewing comments, is that intended?

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I don't see internet points increasing, I upvote.

»
3 years ago, # |
Rev. 3   Vote: I like it +19 Vote: I do not like it

Thanks Mike for this amazing feature!

orz Mike for this astonishing feature!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    Forgiving my dark mind, I laughed so hard every time seeing "orz Mike" xD

»
3 years ago, # |
  Vote: I like it -23 Vote: I do not like it
»
3 years ago, # |
Rev. 3   Vote: I like it +1 Vote: I do not like it

BIT

Segtree

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +83 Vote: I do not like it

    There's a bit of a bug: when I revert to previous revisions and back to current, the markup doesn't work anymore.

»
3 years ago, # |
Rev. 2   Vote: I like it +13 Vote: I do not like it

Do you want Favourite Blog Entries to be collapsible?

  • yes definitely:
  • rather yes, but not necessarily:
  • rather no, I read all of them:
  • no definitely:
»
3 years ago, # |
  Vote: I like it +23 Vote: I do not like it

Seriously?! Almost 1/5th of you prefer spaces over tabs!

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    I am actually not sure what exactly is asked there. Auto-replacing tabs with spaces is more or less a standard practice, so which of the two is this?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it
»
3 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

like update works a little weird (when u like smth, the counter jumps on 2-4 likes up)

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Division 3 rounds

Division 2 rounds

Educational Rounds

Division 1+2 rounds

Unrated rounds

»
3 years ago, # |
Rev. 2   Vote: I like it -15 Vote: I do not like it

It is decidedly so.

Signs point to yes.

Better not tell you now.

Outlook not so good.

»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

I like it except that the icon is so similar to the like button Facebook used sometime.

»
3 years ago, # |
  Vote: I like it +6 Vote: I do not like it

Late editorial after contest:

Fast editorial after contest:

Editorial during contest:

»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Thanks, Mike. This new feature is so great! However, maybe codeforces will have more strange blogs uses this feature but not related to CP. Trash "Likes" blogs may become more.

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

When you vote likes in a blog at HOME page and then refresh the page, the vote by you is not rendered :(

However when you open the blog page, the like is shown correctly.

This a bug, or it is intended?

UPD: It seems that this issue has been fixed. Thanks all the developers! :D

»
3 years ago, # |
Rev. 8   Vote: I like it +60 Vote: I do not like it

Predict how many upvotes this comment will earn:

»
3 years ago, # |
Rev. 3   Vote: I like it -10 Vote: I do not like it

Are you having a great Day

Yes : No :

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    When I voted Yes, it automatically voted No.

    Maybe I am having a great&bad day in the same time.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yeah because i didnt use widget where both have differnt groups. Dont take it personally :-:

»
3 years ago, # |
Rev. 4   Vote: I like it +1 Vote: I do not like it

Unlike voting (the one that affects our contribution), these are revertible at least. Also, we can leave a like to our own widget too.

  • Yes, better:
  • No/ Didn't get:
»
3 years ago, # |
  Vote: I like it +13 Vote: I do not like it

What you prefer most for static RMQ

  1. Segment Tree

  2. Sparse Table

  3. Sqrt decomposition

  4. Binary Indexed Tree

What you know of them?

  1. Segment Tree

  2. Sparse Table

  3. Sqrt decomposition

  4. Binary Indexed Tree

Are you surprised to know that BIT can be used for arbitrary RMQ not only prefix?

  1. Yes

  2. No,I already know that before

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    Are you surprised to know that BIT can be used for arbitrary RMQ not only prefix?

    I really wonder how to solve it. May you tell me?

    Thanks in advance.

    • »
      »
      »
      3 years ago, # ^ |
      Rev. 3   Vote: I like it +9 Vote: I do not like it

      http://ioinformatics.org/oi/pdf/v9_2015_39_44.pdf

      I already implemented query in logn and update in log^2 n but I didn't implement update in logn successfully until now :(

      • »
        »
        »
        »
        3 years ago, # ^ |
        Rev. 4   Vote: I like it +5 Vote: I do not like it

        and the query is 4X times faster than recursive segment tree and as fast as iterative segment tree but I think its easier to implement but there is no use of that when I can't implement the logn update (because I am noob)

        if any one can share his implement I will be thankfull :)

      • »
        »
        »
        »
        3 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        I try implementing the RMQ BIT (queries and updates in $$$O(\log N)$$$) though I am not sure if my implementation is fully correct. I have tried it on the following problems and it seems to be working fine.

        • »
          »
          »
          »
          »
          3 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Your code is not logN update.

          You can see that easily as you have two nested loop any of them have logN complexity.

          I tried these problems already when I was trying to implement and get AC but wasn't able to persuade my self so I generated alot of random tests and compare BIT code with a recursive segment tree.

          And the res is the query operations is so fast around 4X times faster than segment tree but update is so slow as its make 10X time than segment tree there can be two reasons that we didn't see the diffrence in these problems.

          1. Not provided a test with alot of update query.

          2. Provided a test like that but small const factor and a fast query cover that.

          • »
            »
            »
            »
            »
            »
            3 years ago, # ^ |
            Rev. 2   Vote: I like it +5 Vote: I do not like it

            You can see that easily as you have two nested loop any of them have logN complexity.

            But the inner for loop is not reset on every iteration of the outer for loop (the pointer i and j can only go up in the tree), so it should be $$$O(\log N)$$$ right? Similiar to how two pointer is $$$O(N)$$$.

            for (int i = 0, j = 0; i < n; ++i) {
              while (j <= i && ...) {
                ++j;
              }
              ...
            }
            
            • »
              »
              »
              »
              »
              »
              »
              3 years ago, # ^ |
                Vote: I like it +3 Vote: I do not like it

              Oh I am wrong.

              Yes Yes, you are right I miss read the position of j=p-1

              I thought it was in the increment part but I notice now that it is in the initialization part.

              Thanks for the implementation I will revise it carefully now :")

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +145 Vote: I do not like it

    Are you surprised to know that BIT can be used for arbitrary RMQ not only prefix?

    This is not so surprising if you consider what segments a BIT maintains.

    A BIT maintains the solid segments on the right while it is "missing" the dotted segments (that do appear in the segment tree). Notice that the missing segments are exactly the ones you would get if you added another BIT on the reversed array. So it seems intuitive because with two BITs, you at least have the necessary information to answer range minimum queries.

    And from this image it's also not hard to derive how to answer the queries. You jump left on the normal BIT and jump right on the reversed BIT until you meet. This visits essentially the same things as an iterative segment tree, so a similar constant is also plausible.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      That what I was able to do.

      the all problem is update query which my implementation wasn't run corectly so I can only use two get min query on every node two update it with total (logn node)*(logn query for each node) =log^2(n)

      I undrestanded the update process corectly but I wasn't able to implement it sadly :(

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Are you surprised to know that BIT can be used for arbitrary RMQ not only prefix?

    For minimum query on prefix, is it possible to perform updates using arbitrary values?

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yes, and not only for RMQ on prefix but also for arbitrary RMQ

      • »
        »
        »
        »
        3 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Could you explain how? From what I've read from cp-algorithms, we can only do the update if the new value is not greater than the current value.

»
3 years ago, # |
Rev. 2   Vote: I like it -13 Vote: I do not like it

tabs: 1K

spaces: 277

WTF? I can't believe there are so many people in this community who prefer tabs over spaces. It must be the other way around.

A tab could be a different number of columns depending on your environment, but a space is always one column.

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it +57 Vote: I do not like it

    A tab could be a different number of columns depending on your environment, but a space is always one column.

    Exactly. If someone prefers 4 space and you prefer 2, when they use tab you both can see the code in own preferred way. With space you don't have that option. That may be the reason many people prefers tabs.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      What if you're looking at code on someone else's screen?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Maybe there is a little bug: the marks are not visible when I refresh the page. But it works when I click it and removed from liked.

»
3 years ago, # |
Rev. 2   Vote: I like it +60 Vote: I do not like it

No way to see exact number of likes when it crosses 1K. This might be an issue when number of likes for two options are close and both cross 1K.

»
3 years ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it
»
3 years ago, # |
Rev. 2   Vote: I like it +10 Vote: I do not like it

Are u able to implement the like : yes Or no

»
3 years ago, # |
  Vote: I like it +16 Vote: I do not like it

How does this work if you edit your post/comment?

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

scanf & printf :

cin & cout :

fread & fwrite :

write custom read() function :

»
3 years ago, # |
  Vote: I like it +9 Vote: I do not like it

exactly one of them tells a lie!

  1. you will like this one.
  2. you will like the third one.
  3. you will like this one.
  4. you will not like this one.
»
3 years ago, # |
Rev. 2   Vote: I like it +51 Vote: I do not like it

Maybe we can change the '1K' to something like '1.06K'. This way the number of likes will be clearer as 1.99K and 1.01K are probably shown as '1K' now.

btw orz Mike

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I see only plain text when I go through previous revisions of comments, and it doesn't get fixed when I go back to the recent revision. Also, the icon is not rendered in comment previews.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What's most important,

  • Rating:
  • Contribution:
  • Likes:
»
3 years ago, # |
Rev. 5   Vote: I like it +11 Vote: I do not like it

When you roll back a revision(click ←) and redo it, you'll find like system failed to be loaded.

BTW in spite of these bugs this is still a great system:)

»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

My choices are messed up, it shows the choices I didn't vote for yesterday.

»
3 years ago, # |
  Vote: I like it -41 Vote: I do not like it

1.) Like #5 only if it is Thursday

2.) Ignore #1 if you are not currently liking #4

3.) Upvote my comment

4.) If the time in minutes is an odd number, Ignore #6

5.) If you haven't liked an odd number of statements, you must go back and obey enough rules to make your count of obeyed rules a multiple of five.

6.) Ignore #2 if the number of times you have liked #4 and number of upvotes on this comment is a Lucas Number

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If you like one you will like all of them.

    Use it correctly.

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

P.S.This is a test. (Upd: It works!

(Original

qwq | qvq

qaq

QwQ QAQ

(New

Solve the following two-sat problem:

No.1 is 0 or No.6 is 1

No.2 is 0 or No.3 is 1

No.2 is 1 or No.4 is 0

No.3 is 1 or No.4 is 1

No.3 is 0 or No.1 is 1

No.1 is 0 or No.2 is 0

No.6 is 0 or No.5 is 0

No.4 is 0 or No.5 is 1

No.1 No.2 No.3 No.4 No.5 No.6

»
3 years ago, # |
  Vote: I like it +2 Vote: I do not like it

0-based indexing

1-based indexing

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Need a dislike button.

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
»
14 months ago, # |
  Vote: I like it +6 Vote: I do not like it

wow! amazing feature! loved it

»
9 months ago, # |
  Vote: I like it -16 Vote: I do not like it
»
3 months ago, # |
  Vote: I like it -9 Vote: I do not like it

What is your favorite programming language?

Python:
Java:
C++:
JavaScript:
Other:

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

just trying it out

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

(likes:1)

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

[liks:1,Opt1]

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it
»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it
»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it
»
2 months ago, # |
Rev. 8   Vote: I like it 0 Vote: I do not like it

Team Game of Thrones:

Team Money Heist:

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