aj95's blog

By aj95, 7 years ago, In English

Hi,

I've written few blog entries to provide some useful resources and problems to solve to help people get comfortable with the concepts. Check out them here :

Edit: Added — Network Flow

Link to blog : Link

I hope these articles will be useful.Feel free to give feedback.

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

| Write comment?
»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The title says it's for beginners, but the blog post says it is only for high level understanding.

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

    I've written beginners keeping in mind all the red coders and similar people here. The blog is meant for beginners but with atleast certain level of knowledge and experience.

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

I was looking through your solution http://codeforces.com/contest/585/submission/17410169 and having some problems in understanding some parts , i am writing what i understood could you reply whether i am correct or not ?

temp1 = (ModPow(2, n, MOD) — 1 + MOD) % MOD; // all the subsets excluding the empty one are taken

for (i = 1; i <= N; i++) {
    g[i] = h[i] = 0;
    if (u[i] == 0)
      continue;
    for (j = i; j <= N; j += i)
      g[i] += c[j];
    temp2 = u[i] * (ModPow(2, g[i], MOD) - 1);
    h[i] = (temp2 + MOD) % MOD;
    temp1 = (temp1 - temp2 + MOD) % MOD;
  }

// then we are iterating over all possible numbers allowed and for those numbers containing no square factors as calculated by the mobius function, for a particular value we are taking all subsets having multiples as this number and subtracting the subsets possible excluding the empty one from the temp1 .So after loop in temp1 we are having count of subsets having gcd as 1.

answer = n * temp1; // the man is coming in n instances so we are first assuming that for whatever number he chooses we will always give the complete set that is all those subsets having gcd equal to one so that since the gcd is initially one any number he chooses , the combined gcd would be one.


for (j = 2; j <= N; j++) { answer = (answer + (g[j] * h[j]) % MOD + MOD) % MOD; }

// this loop is troubling me assuming he takes number j why are we adding this thing the h[j] is the number of subsets having gcd j so we are violating the condition . Can you please explain me?

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

Thank You for the tutorials

»
7 years ago, # |
  Vote: I like it +3 Vote: I do not like it

I've seen this blog to come up in recent actions a lot of time. Whenever I open it, there is no new comment that I can see. Also the blog text has just 1 edit. Why does this happen?