dev-onejun / Algorithm-Study

[Since 2019] Algorithm Study
0 stars 1 forks source link

CODEFORCES: 893C - Rumor #12

Open dev-onejun opened 1 year ago

dev-onejun commented 1 year ago

https://codeforces.com/problemset/problem/893/C

dev-onejun commented 1 year ago

Idea

  1. ascending sort by the amount of required bribing gold. (Greedy)
  2. make connected graphs not regrading as dfs or bfs. (Searching Algorithm)
dev-onejun commented 1 year ago

The idea on 3d52da3 was continuously emitted Runtime error on test 4.

Actually, I tried to find the solution about this problem because there is no defect in my idea.

And, in some perspectives, as my thought, it was a problem using dfs or bfs which means Runtime error on this problem was related to the Time Exceed. 83c67f6 is passed because it uses deque which has more time priority than dfs.

I wonder there are another solutions as dfs in python. This user solved as dfs but in C++.

My Submission

https://codeforces.com/contest/893/my