### helpme's blog

By helpme, 21 month(s) ago, ,

I think, some regions are getting less slots despite having better contestants. But people in some other regions take slots as granted. They don't care at all about WF. They think that qualifying for WF is a lifetime achievement, why bother practicing, let's enjoy the tour instead. So, they don't even stand under rank 50, for years after years!! Participants from these regions continuously perform poorly. So, I think it is better if their slot was decreased so that they would be motivated to perform better next time.

• +7

By helpme, 4 years ago, ,

Hello everyone,

Recently I've read some tutorial on hashing, I learned that after some preprocessing we can find the hash of a substring in O(1) using modular inverse. But, I was surprised to see that people do not use modular arithmetic! For example, see this submission: 845264, How is it counting hash? Is it utilizing the integer overflow? Moreover, it does not use any modular inverse to find the hash of a substring, e.g.

inline int hh(int x,int y)
{
return a[y]-a[x-1]*p[y-x+1];
}


I can't understand how it actually works. It would be great if any of you could explain this or suggest some online resources about this.

• -1

By helpme, history, 4 years ago, ,

We have an array of numbers 0 and 1. For every index R, we need to find the leftmost index L so that total number of 0's between L and R is more than 1's. We have to find the length (R-L+1). For example,

consider this array: 1 0 1 0 0 1 1

for the 2nd index, length is 1: 1 0 1 0 0 1 1
for the 3rd index, length is 0: 1 0 1 0 0 1 1
for the 4th index, length is 3: 1 0 1 0 0 1 1
for the 5th index, length is 5: 1 0 1 0 0 1 1

We have to find the length for every index. My question is, can it be done in linear time complexity? Or, what's the best time complexity to solve it? Please share your ideas! Thanks.

• +17

By helpme, history, 4 years ago, ,

Hello everyone,

I need some help understanding the solution of a problem. The problem is, find the number of ways to represent a number. For example, 4 can be represented in 8 ways: 4, 1+3, 3+1, 2+1+1, 1+2+1, 1+1+2, 2+2, 1+1+1+1

After some calculation I found that, answer of this problem is f(n) = 2^(n-1). e.g.

f(1)=1
f(2)=2
f(3)=4
f(4)=8
f(5)=16


can anyone explain why the answer is 2^(n-1) ? Thanks in advance!

• +1

By helpme, history, 4 years ago, ,

Hello everyone,

I'm worried about my contribution, so I would like to help codeforces to get some upvotes :)

Codeforces is facing serious troubles with div2 contests, many fake accounts loot div2 winning positions! If we want to stop them we have to understand what they want. They want to be famous. They want rating, because rating is motivation. That's why I suggest to create a different rating system for out-of-competition participants!

• +3

By helpme, history, 5 years ago, ,

Hello everyone,

Today I had to make a test case with 1000 characters, so I had to write a txt file. I wrote this program:

#include<bits/stdc++.h>
using namespace std;
int main ()
{
freopen("zxq.txt" , "w" , stdout) ;
for(int i = 0 ; i < 1000; i++)
cout << rand() % 2 << ' ' ;
}


but, when I opened the zxq.txt file there were some other charaters like '‱' and '‰' not '0' or '1' ! But, when I changed the code as following it worked correctly:

#include<bits/stdc++.h>
using namespace std;
int main ()
{
freopen("zxq.txt" , "w" , stdout) ;
for(int i = 0 ; i < 1000; i++)
cout << rand() % 2 ;
}


Can anyone please explain why it is working like this or how to resolve this problem?