rezaulhsagar's blog

By rezaulhsagar, 7 years ago, In English

Hello,

We are sorry to bother you by this post. But currently we don't find any better solution by ourselves.

Recently we(me & rifat_072) were learning matching / flow related topics. But we have found that, these topics are hard nut to crack. We know some algorithms like, Hungarian algorithm for matching, Edmond Karp etc. But we failed to find a friend who knows flow / matching related topics well enough to clear our confusion in some areas. If you have enough time to help us, kindly message in private so that we may discuss the topics over video / voice call over any social networking site.

Thanks in advance for your kind help.

Full text and comments »

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

By rezaulhsagar, history, 7 years ago, In English

Hello! I'm facing some difficulties here in this problem. I thought it would be a straightforward data structure problem. But the memory constraints here made me about to cry. Is there any way to cut the problem down to a 1D BIT?

Problem link: SPOJ — CCOST

Full text and comments »

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

By rezaulhsagar, history, 8 years ago, In English

Hi, In a graph problem, I need to memset a whole 2D array with a large value that denotes INFINITY.

Currently, I am doing this by running a O(N*N) loop.

const int maxx = something;
int grid[maxx+7][maxx+7];
for(int i=0;i<maxx;i++){
   for(int j=0;j<maxx;j++){
      grid[i][j] = large_value;
   }
}

Is there a better way to do this?

Also, I have tried memset function.

memset(grid,127,sizeof grid) resets all values to 2139062143

memset(grid,128,sizeof grid) resets all values to -2139062144

Why memset works like this?

Thanks in advance!

Full text and comments »

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

By rezaulhsagar, history, 8 years ago, In English

Hi all!

This is my first entry on Codeforces. Ignore my bad English.

Over the last few weeks my contest performance was terribly poor. It's not the fact that the problems are too much hard. Even I can solve it on paper in less than 10 minutes with implementation. Then after coding, I submitted and and got several WAs.

The mistakes were too funny. Not clearing vector elements, not using parenthesis in an equation, displaying wrong variable, using a[i] instead of i bla blah... :(

I have a strange mentality. During contest time, I feel I need to solve quickly. As my friends are solving Div-2 A in less than 15 minutes, I feel embarrassed to be the lower ranked on the table. So, after seeing WA in a pretest, I want to debug quickly. I use a long long instead of int, resubmit, WA again in same pretest. (Isn't it funny?)

I don't want to quit problem solving. But, this is too frustrating when I make same mistakes over and over again. I hate being gray.

Is there any remedy against it? Should I stop taking part in contests for some time?

Any suggestion?

[frustrated emo]

Full text and comments »

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