rhz's blog

By rhz, history, 13 days ago, In English
Just Like This(Language:BrainFuck)

 
 
 
 
  • Vote: I like it
  • +2
  • Vote: I do not like it

»
13 days ago, # |
  Vote: I like it +8 Vote: I do not like it

XD

»
12 days ago, # |
  Vote: I like it -55 Vote: I do not like it

could any one help me with some LIS(dp) pair vector problem , the statement we got array a of {wieghts, IQ} of elephants, we want max subset of the seq (**print seq** too) that validate w(a[i]) < w[a[i+1]) and IQ(a[i]) > IQ(a[i+1]). could any one solve it in O(n log(n))n any idea ?

  • »
    »
    12 days ago, # ^ |
    Rev. 3   Vote: I like it +27 Vote: I do not like it

    Hint ($$$O(n \log^2n)$$$ though)

    UPD: why downvotes?

    • »
      »
      »
      12 days ago, # ^ |
        Vote: I like it +20 Vote: I do not like it

      because the question is irrelevant to the blog?

      • »
        »
        »
        »
        12 days ago, # ^ |
          Vote: I like it +33 Vote: I do not like it

        I meant downvotes to my answer. Btw yes, it's a good point, maybe I should have answered somewhere else.

»
12 days ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

I was always amused by interesting cycles, for example : for(int i=0;i<n;i-=-1)

Sorry, I didn't see a little about what code we are talking about :)

  • »
    »
    12 days ago, # ^ |
      Vote: I like it +73 Vote: I do not like it

    You can also implement loops with the downto operator -->

    for(int i = n;i-->0;)
    
    • »
      »
      »
      12 days ago, # ^ |
        Vote: I like it +58 Vote: I do not like it

      Hey wait a minute. That's not an operator, that's just -- and >

      • »
        »
        »
        »
        11 days ago, # ^ |
          Vote: I like it +14 Vote: I do not like it

        Haha yeah. For kids:

        for(int i = n; (i--) > 0;)

»
12 days ago, # |
  Vote: I like it +5 Vote: I do not like it

Recently I looked at python co-routines, which give a really strange way to approach problems. See https://gist.github.com/ramalho/da5590bc38c973408839 for conways game of life. Somehow, we have a function step_cell which is accessing state used in a sibling function live_a_generation, but neither method is calling another and there are no global variables. Instead, it kind of looks like two methods are running in parallel (although they aren't).

If that gist is too long for you, I also implemented 2 pointers in this same weird style and it's only about 20 lines https://codeforces.cc/contest/1133/submission/131576712

»
12 days ago, # |
Rev. 2   Vote: I like it -11 Vote: I do not like it

I upvoted only because of the anime girl in the blog

»
12 days ago, # |
  Vote: I like it +15 Vote: I do not like it
DISCLAIMER: I am not responsible for mental and emotional damages contents of this spoiler might cause
  • »
    »
    12 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    2 + 3 — 1 .

    Reverse Indexing is interesting in cpp! I discovered this a few months ago. I love this concept.

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

      For C-style arrays, array indexing is equivalent to pointer arithmetic, i.e. a[i] == *(a+i), so the mystery is solved there.

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

    Now i really regret my decision! I shouldn't have opened it.

  • »
    »
    10 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Really man , what is this !! truly strange

»
12 days ago, # |
  Vote: I like it +24 Vote: I do not like it
int p[] = {-1, n};
while (p[1] - p[0] > 1) {
    p[!f(p[0] + p[1] >> 1)] = p[0] + p[1] >> 1;
}
// p[0] == largest i such that f(i) is true
// p[1] == least i such that f(i) is false
»
11 days ago, # |
  Vote: I like it 0 Vote: I do not like it

waifu

»
11 days ago, # |
  Vote: I like it +5 Vote: I do not like it

Nice zig-zag pattern in this code made using only swap XD. CODE. Most weird code for me.

»
11 days ago, # |
Rev. 3   Vote: I like it -28 Vote: I do not like it

No anime girls in codeforces!!!!!!

No anime girls in codeforces!!!!!!

No anime girls in codeforces!!!!!!

Say no to blogs with anime!!!!!!

Say no to blogs with anime!!!!!!

Say no to blogs with anime!!!!!!

Important things should be repeated for three times.

»
11 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by rhz (previous revision, new revision, compare).

»
11 days ago, # |
  Vote: I like it 0 Vote: I do not like it

How about the Sleep Sort?

»
11 days ago, # |
  Vote: I like it 0 Vote: I do not like it

What about This : )

Language:Chef
»
10 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

PyRival has some interesting code to try to make python CP-viable.

The most well-known code it implements is to overhaul python's slow I/O with custom FastIO in the form of lower-level syscalls, which can often be the difference between AC and TLE. https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

Also thanks Miku.

»
7 days ago, # |
  Vote: I like it 0 Vote: I do not like it

I've understood,but you made impertinent remarks.

»
7 days ago, # |
  Vote: I like it +10 Vote: I do not like it

have you written the blog to ask a real question or to show an unrelated anime picture?

»
7 days ago, # |
  Vote: I like it 0 Vote: I do not like it
»
7 days ago, # |
  Vote: I like it 0 Vote: I do not like it

this

(If you don't know about Chinese, just click the links.