Gnay_Oahnauhz's blog

By Gnay_Oahnauhz, history, 3 years ago, In English,

I want to ask you about your opinions on an idea about promoting competitive programming at my university.

The rough idea is like this:

When there is a rated round on codeforces, people in my university can have a choice to pay a little amount of money, say $1, to me to compete in that round. And after that round, competitors who do better will earn money from competitors who do worse. I don't make money by doing so, which means all the money collected will be distributed according to the competitors' performance. I hope this will make the game more excited and attract more people, just like in RPG games.

There are still details I don't work out. For example, how to distribute the money? How to distinguish coders with different skill level, so that everyone will have the chance to win money?

Please kindly provide your advice on the idea. Do you think this idea is viable or not? Or are there platforms like this already? Or do you think this idea is completely inappropriate.

Read more »

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

By Gnay_Oahnauhz, history, 3 years ago, In English,

Usually in my timezone, the contest begins at midnight. So I have to keep awake and clear if I want to take part in it.

I've tried sleeping awhile before and drinking coffee/redbull. But still it simply didn't help or had some side effects.

If I sleep, I still feel tired during the contest and want to sleep.

If I drink coffee/redbull, not only will I feel tired, but also I will not be able to sleep even AFTER the contest.

In both cases, I simply can not come up with a solution to problems if they require some deeper thinking. And normally I will figure out how to solve them the next morning. I will blame myself for not being clear enough to solve them last night during the contest and become frustrated.

Do you feel the same if you take part in contests at midnight? How do you deal with this problem?

Read more »

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

By Gnay_Oahnauhz, history, 3 years ago, In English,

The problem is like this: You are on the origin of a number axis, each time, you can move forward, backward or stay with probability Pf, Pb, Ps = 1 - Pf + Ps respectively, i.e., if you are on x now, the next step you can move to x + 1 with probability of Pf and etc. And the question is: after n steps, what's the mathematical expectation of the maximal number you have reached.

Here's an example when n = 2, Pf = 0.25, Pb = 0.25, Ps = 0.5:

maximal number: 1
fs: 0.25*0.5 = 0.125
sf: 0.5*0.25 = 0.125
fb: 0.25*0.25 = 0.0625 (since you have arrived at number 1, even if you go back, you will have maximal number 1)
maximal number: 2
ff: 0.25*0.25 = 0.0625

since you are on the origin, all other path will have maximal number equal to 0

Thus the expectation is: 1*(0.125+0.125+0.0625)+2*0.0625=0.4375

There is a dp solution on the problem, but I just can't quite figure out why:

UPD: Sorry for the lack of constraint: n <= 2000, 1s, 256MB

And the solution is like this:

// let f, b be the probability P_f, P_b described above, then, P_s = 1 - f - b;
double dp[2010][2010];
dp[0][0] = 1.0;

double ans = 0;

for(int i = 0; i < n; i++) {
  ans += f * dp[i][0];
  for(int j = 0; j <= i; j++) {
    dp[i + 1][max(j - 1, 0)] += dp[i][j] * f;
    dp[i + 1][j] += dp[i][j] * (1 - f - b);
    dp[i + 1][j + 1] += dp[i][j] * b;
  }
}

cout<<ans<<endl;

Read more »

 
 
 
 
  • Vote: I like it
  • -3
  • Vote: I do not like it

By Gnay_Oahnauhz, history, 3 years ago, In English,

Hi, is there something wrong with codeforeces? I just submitted 662C - Binary Table but received judgement failed. Or is there something wrong with my code ?17519175

Read more »

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