| # | User | Rating |
|---|---|---|
| 1 | jiangly | 3810 |
| 2 | Benq | 3676 |
| 3 | Kevin114514 | 3655 |
| 4 | maroonrk | 3463 |
| 5 | strapple | 3390 |
| 6 | Um_nik | 3387 |
| 7 | tourist | 3384 |
| 8 | heuristica | 3322 |
| 9 | turmax | 3319 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | Um_nik | 143 |
| 5 | AmShZ | 142 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | maroonrk | 133 |
| 9 | BledDest | 132 |
| 10 | qwexd | 129 |
| Name |
|---|



It's not recommended to use something like
left->get_size()when you know thatleftcan be equal tonullptr. It's undefined behaviour, so crashes on Codeforces.cpp.sh uses an old version of GCC (4.9.2). In newer versions, compiler makes some optimizations with this, so the program crashes.
Consider using something like this:
I didn't submit it, but in Codeforces' "Custom invocation" it works and gives correct answer :)
Thanks. Your solution did the trick
You're welcome! :)
That's weird but I've got another problem of that kind. Now I get RE2 with C++14 24456589 and WA1 with C++11 24456640. I double-checked my code for any type of calling
nullptr's and I'm sure there is nothing about that. And it still works fine on my machine and cpp.sh. Won't you please guess what's wrong this time?Strange... I removed
volatileand it worked! Doesn't have ideas why.Also consider initializing
leftandrightinTreap::Node's contructor.Well, it didn't fix WA1 with c++11 but now I have RE4 with c++14
Thanks a lot, it helped. It is so confusing that UB sometimes works right. I guess I have a lot of learning to do