Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official.
×

# | User | Rating |
---|---|---|

1 | Radewoosh | 3759 |

2 | orzdevinwang | 3697 |

3 | jiangly | 3662 |

4 | Benq | 3644 |

5 | -0.5 | 3545 |

6 | ecnerwala | 3505 |

7 | tourist | 3486 |

8 | inaFSTream | 3478 |

9 | maroonrk | 3454 |

10 | Rebelz | 3415 |

# | User | Contrib. |
---|---|---|

1 | adamant | 172 |

2 | awoo | 167 |

3 | SecondThread | 163 |

4 | BledDest | 162 |

4 | Um_nik | 162 |

6 | maroonrk | 161 |

7 | nor | 160 |

8 | -is-this-fft- | 150 |

9 | Geothermal | 146 |

10 | TheScrasse | 143 |

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial of Codeforces Round 377 (Div. 2)

↑

↓

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/30/2023 15:05:59 (k2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Auto comment: topic has been translated by danilka.pro (original revision, translated revision, compare)I think I used a simpler method for C, this is the observation:

Let M be the maximum of {b, d, s}; then the other 2 would be in the best case M — 1. So if b is the maximum, then (d >= b — 1 and s >= b — 1) always holds true.

This is the code: http://codeforces.com/contest/732/submission/21550209

"So if b is the maximum, then (d >= b — 1 and s >= b — 1)

alwaysholds true."In case {

b= 6,d= 3,s= 3} your statement is wrong. In that casebis maximum, butd<b- 1 ands<b- 1. Or did I miss something?can someone explain last line for f. with example? why orient (v,to) to (to,v)?

Just think about it, if you are pointing from v→to, you are leaving the largest cycle pointing outwards.

Hi, I'm not understanding why my submission is getting TLE for Div2 F. can anyone please check it? Here's my submission, 21830666 I have implemented it exactly as given in the tutorial.

In Problem B, test-10:

Obviously my answer is better?

"

Write a program that will find the minumum number of additional walks"I am pretty sure it is not obvious that 4 < 3.

Div2D Exams

Consider the following test case

The following AC submission gives the answer as 9. I would like to know how is the answer 9 correct. Since subject 3 requires 4 days of preparation, which clearly isn't possible, shouldn't the answer be -1 ?

It was mentioned that the test cases are flawed and some wrong solutions managed to get an AC.

can someone provide an explanation on why is the mentioned strategy of orienting edges in problem F optimal? i.e. why does it allow us to traverse from any vertex to any other vertex in an 'edge' connected component?

Test cases for D are very trivial. All of them pass through wrong solution also.

Can anyone provide proof of correctness for problem F ? I am not sure whether the solution in tutorial is correct

Can someone please explain the editorial of Problem F? I can't get why the answer is the largest component!

For example take the following graph:

We have two bridges (6,7),(10,11). Now first without considering bridges we will direct other edges,and they will be obviously completely connected as there will be a cycle(because all the bridges already have been removed)

Now come to bridges, if we direct 10--->11 then ri for (i=11,12,13) will be equal to 3 else if we direct 10<---11 then ri for (i=11,12,13) will be equal to 7

So we direct edge from smaller to larger ,to get 7 over 3 Similarly we will do this with 6<---7 else (7--->6) ri for (i=7,8,9,10) will be 4 (focusing on minimum ri)

So largest component can reach only to the vertices which come in its component after removing all bridges.If we take direct edge from higher component to lower component (higher and lower is with respect to number of vertices in component) ,then minimum can't be maximize,therefore answer will be largest component.

Happy Coding :)

That was really a great explanation. Thanks!

Problem D please someone Add this Test Case if possible

My Code Output

12

Actual Output

17

Still it got Accepted

the test cases of problem D are weak.my solution is wrong but got ac. for the test case

16 3

0 0 1 0 2 0 0 3 0 0 0 0 0 0 0 1

2 4 7

ans should be -1 but mine gives 16

Actually we don't need to find bridges in problem F. For every edge $$$(u, v)$$$ in our DFS path, just orient it from $$$v$$$ to $$$u$$$. Refer to my submission: 117700144.

Can someone please explain D

Assume you passed N-1 exams then the days between (N-1)th exam and Nth exam can only be utilized for the Nth subject.we can make the same argument for (N-2)th exam day and (N)th exam day. The days between them can only be utilized for N-1th subject and Nth subject.