Parvej's blog

By Parvej, history, 3 months ago, In English

While solving this problem 1359C - Mixing Water . I observed a strange thing.

The same code is giving different outputs on different compilers. WA- 146913145 AC- 146915566

I found the test case for which the compilers gave different outputs.

Test Case

for this test case, c++17(64bit) is giving 499979 as output. but c++17 is giving 499981 as output which is as same as correct output.

I want to say that my outputs are compared to the outputs of the authors' solution which was run on c++17. But my solutions should be compared to the outputs which were run on c++17(64bit).

Read more »

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

By Parvej, history, 6 months ago, In English

I got a runtime error on the last Atcoder Regular Contest.

The problem is this .

My RE solution here .

Runtime Error Part
RE test case

I always wrote (char) ('a'+k)to get the kth letter from the alphabet and didn't get Runtime Error on any platform.

Why am I getting RE this time?

Read more »

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

By Parvej, history, 14 months ago, In English

We know that a tree has either 1 or 2 centroids. I can find one centroid using simple dfs.

But, if a tree has 2 centroids, Is there a way to efficiently find the other one?

In case you don't know about centroids of a tree. See here

Read more »

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

By Parvej, history, 18 months ago, In English

How can I find all the simple cycles in an undirected graph?

126615260_419079712777006_8560932289449234104_n.png In the picture, there are 3 simple cycle:

  1. 1-2-3

  2. 1-2-4-5

  3. 1-3-2-4-5

How can I print all of them?

Read more »

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

By Parvej, history, 2 years ago, In English

In this problem 1008C - Reorder the Array

I used upper_bound(multiset.begin(),multiset.end(),x) and got TLE.

TLE Sub: 77006832

But when I used multiset.upper_bound(x), I got accepted!

AC Sub:77081261

Can anyone explain to me why inbuilt upper_bound() is slower than the member upper_bound() function of std::multiset?

Read more »

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