Shahriar_CSECU's blog

By Shahriar_CSECU, history, 6 years ago, In English

I have used sqrt decomposition but got wa in test 4.But the test case is not given full but some dots in last part.And also didn't find any bug in may code.Can anyone please help me to find the bug. Thanks In Advance.

E-Holes

My Code.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Shahriar_CSECU, history, 6 years ago, In English

In this tutorial first code is :

map<int, int> *cnt[maxn];
void dfs(int v, int p){
    int mx = -1, bigChild = -1;
    for(auto u : g[v])
       if(u != p){
           dfs(u, v);
           if(sz[u] > mx)
               mx = sz[u], bigChild = u;
       }
    if(bigChild != -1)
        cnt[v] = cnt[bigChild];
    else
        cnt[v] = new map<int, int> ();
    (*cnt[v])[ col[v] ] ++;
    for(auto u : g[v])
       if(u != p && u != bigChild){
           for(auto x : *cnt[u])
               (*cnt[v])[x.first] += x.second;
       }
    //now (*cnt[v])[c] is the number of vertices in subtree of vertex v that has color c. You can answer the queries easily.

}

In comment author told that "now (*cnt[v])[c] is the number of vertices in subtree of vertex v that has color c. You can answer the queries easily."

But I can't answer the queries.I can't implement the query function my self.I tried it for a long time but failed.Can anyone implement it for me.It will be great help.

Thanks in advance.

Full text and comments »

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

By Shahriar_CSECU, history, 6 years ago, In English

How problem setters creats strong test cases for problem.I want to know their strategy.I hope this will help me when I get Wa,TLE,MLE in contest. I also want to be a good problem setter (but I am not skilled enough now).So I want to practice creating critical test cases for problems.I hope this will help me in contest as well as when I will start to set problems in contest in different oj.(If My Allah wants).

Full text and comments »

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

By Shahriar_CSECU, history, 6 years ago, In English

I am new to dp on trees and trying to learn by solving problems. I am stuck in an spoj problem. Can Anyone give me some idea to solve this problem? Problem link

Any advice about how to improve skill on dp on trees and where to learn, will be welcomed.I am facing difficulties to acquiring this knowledge.

Thanks in advance.

Happy coding :)

Full text and comments »

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

By Shahriar_CSECU, history, 6 years ago, In English

Won't SnackDown contest be held this year? Last year it was held 20th may. But now it is 19th June, but still no announcement.

Full text and comments »

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