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

Автор Peace_789, 4 года назад, По-английски
  • Проголосовать: нравится
  • -37
  • Проголосовать: не нравится

Автор Peace_789, история, 4 года назад, По-английски

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

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

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

Автор Peace_789, история, 4 года назад, По-английски

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

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

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

Автор Peace_789, история, 4 года назад, По-английски

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.

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

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

Автор Peace_789, история, 4 года назад, По-английски

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.

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

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

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

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

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

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

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

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

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

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