This problem (270B - Multithreading) is a bit tricky to understand. Here's what's happening. Suppose there are 5 threads. There position were 1,2,3,4,5 before refreshing. Suppose the thread '2' just had a new message, so, after refresh it will move to the top of the list. So, the new position of threads will be 2,1,3,4,5. After that if thread 3 had a new message, then the resulting position of threads after refresh will be 3,2,1,4,5. Thus, if we analyze closely, we have to a find the number of elements which are not in strictly decreasing order (as traversed from the end of the array)! I implemented it using std::stack and it got accepted, clocking at 62 ms.
I don't know why my fellow coders are downvoting this post. At least, when you downvote, give me an explanation. I will try to improve.
You made it look like an announce of a CF round. But it's just a tutorial for a single problem. That's misleading — good enough reason to downvote.
Sorry for that..it was my first blog post. So, I didn't consider that it will be misleading. Thank you for your remarks.
Why are you doing a partial tutorial aside the official tutorial? To find it google for "site:codeforces.com #165" or view the announcement that is linked directly from your problem. If you have just a different idea of solution, people usually post it as comments to tutorial blog.
If you thought that there is no official tutorial because you couldn't find it — that's a good reason to downvote too :)
Anyway I see people frequently give wrong, too general titles for their blogs. "270B tutorial" would be much better.
Again thanks for your feedback ! As I was new to blogging, I didn't get much of it first. I will try to avoid these mistakes in the future. The comments were a great help. :)
becoz it's fun :P