Peace_789's blog

By Peace_789, 4 years ago, In English
  • Vote: I like it
  • -37
  • Vote: I do not like it

By Peace_789, history, 4 years ago, In English

Hey guys...

Recently I was solving this problem from CSES.

Here is what I have tried...

My idea

By implementing this idea , I am getting WA in one TC ( Out of 11 ).

You can find my code here.

code

So , can someone point out what am I doing wrong or any cases that I am missing.

Thanks in advance :)


UPD

As pwild sir pointed out , I was missing that cases.

To overcome that , I just added small logic to my code and it got ACCEPTED.

If you want to see code...

accepted code

Full text and comments »

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

By Peace_789, history, 4 years ago, In English

Hello guys , I am having trouble solving this problem

You can read problem statement here also.

Statement

So , any hint to solve this problem will be grateful.

Thanks in advance :)

Full text and comments »

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

By Peace_789, history, 4 years ago, In English

Hello everyone...

First of all sorry but I am writing the blog on same doubt again because there was some issues with code in last blog.

So , recently I was solving this problem ...

Problem statement

I am aware of solving this problem using Bellman Ford's Algorithm , But I am trying another approach which is giving me WA in 1 Test Case (total 13 is there) .

So , Can anyone point out whether this approach is correct or not ... and If it is correct then suggest me some modification else give some counter examples where this code might fail.

Code

Any kind of help will be appreciated.

**Feel free to downvote but help me if you know the answer ;) **

THANKS.

Full text and comments »

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

By Peace_789, history, 4 years ago, In English

Hello Everyone ...

Today I was solving this problem ... Problem statement : You are given a directed weighted graph, and your task is to find out if it contains a negative cycle, and also give an example of such a cycle.

I am aware of solving this problem using Bellman Ford's Algorithm , But I am trying another approach which is giving me WA in 1 Test Case (total 13 is there) .

So , Can anyone point out whether this approach is correct or not ... and If it is correct then suggest me some modification otherwise give some counter examples where this code might fail.

code

Thanks in advance :) and sorry for my bad english.

Full text and comments »

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

By Peace_789, history, 5 years ago, In English

Hey there ...

Today I was solving these problem click ... and I got tle verdict on TC 5. Here's a link to my solution click.

As much as I got , time complexity of my above solution is O(nlogn) where n can be upto 10^5.

So , I am not getting why it is giving tle verdict. So any help regarding this would be appreciated.

Thanks in advance ;)

UPD ==================: Was getting TLE due to ( endl ).

Full text and comments »

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

By Peace_789, history, 5 years ago, In English

Can someone share some problems on Articulation Points and bridges in a graph ! Thanks in advance :)

Full text and comments »

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