Codeforces Round 775 (Div. 1, based on Moscow Open Olympiad in Informatics)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1648 Codeforces Round 775 (Div. 1, based on Moscow Open Olympiad in Informatics) FINISHED False 8100 85262699 March 6, 2022, 9:55 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 135 ) F Two Avenues PROGRAMMING data structures dfs and similar graphs

B"In order to make the capital of Berland a more attractive place for tourists, the great king came up with the following plan: choose two streets of the city and call them avenues. Certainly, these avenues will be proclaimed extremely important historical places, which should attract tourists from all over the world. The capital of Berland can be represented as a graph, the vertices of which are crossroads, and the edges are streets connecting two crossroads. In total, there are n vertices and m edges in the graph, you can move in both directions along any street, you can get from any crossroad to any other by moving only along the streets, each street connects two different crossroads, and no two streets connect the same pair of crossroads. In order to reduce the flow of ordinary citizens moving along the great avenues, it was decided to introduce a toll on each avenue in both directions. Now you need to pay 1 tugrik for one passage along the avenue. You don't have to pay for the rest of the streets. Analysts have collected a sample of k citizens, i -th of them needs to go to work from the crossroad a_i to the crossroad b_i . After two avenues are chosen, each citizen will go to work along the path with minimal cost. In order to earn as much money as possible, it was decided to choose two streets as two avenues, so that the total number of tugriks paid by these k citizens is maximized. Help the king: according to the given scheme of the city and a sample of citizens, find out which two streets should be made avenues, and how many tugriks the citizens will pay according to this choice. Each test consists of multiple test cases. The first line contains one integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 3 <= q n <= q 500 ,000 , n - 1 <= q m <= q 500 ,000 , m <= frac{n (n - 1)}{2} ) -- the number "...

Tutorials

Codeforces Round #775 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
148616993 djq_cpp F March 6, 2022, 2:29 p.m. OK GNU C++14 TESTS 181 3244 279552000
148613542 maroonrk F March 6, 2022, 1:57 p.m. OK GNU C++17 (64) TESTS 181 5163 312934400

remove filters

Back to search problems