Блог пользователя Shahriar_CSECU

Автор Shahriar_CSECU, история, 6 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Shahriar_CSECU, история, 6 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

Автор Shahriar_CSECU, история, 6 лет назад, По-английски

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).

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор Shahriar_CSECU, история, 6 лет назад, По-английски

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 :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор Shahriar_CSECU, история, 6 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +131
  • Проголосовать: не нравится