### MikeMirzayanov's blog

By MikeMirzayanov, 4 years ago,

Hello Codeforces!

I hope you enjoyed the problems. I forgot to mention the contribution of testers to the preparation of problems in the round announcement. I apologize and correct myself. Many thanks to the testers: elizarov, I_Remember_Olya_ashmelev, KAN, BanRussiaAtIOI, adedalic and Roms. Also many thanks to my co-authors: 300iq and geranazavr555. Special thanks to cannor147 who helped with translations.

#### 1211A - Три задачи

Problem writer: MikeMirzayanov

Tutorial

#### 1211B - Путешествие по Золотому кольцу Берляндии

Problem writer: MikeMirzayanov

Tutorial

#### 1211C - Мороженое

Problem writers: MikeMirzayanov, geranazavr555

Tutorial

#### 1211D - Команды

Problem writer: MikeMirzayanov

Tutorial

#### 1211E - Double Permutation Inc.

Problem writers: MikeMirzayanov, geranazavr555

Tutorial

Problem writer: MikeMirzayanov

Tutorial

#### 1211G - Путь короля

Problem writer: MikeMirzayanov

Tutorial

#### 1211H - Ремонт дорог в Древляндии

Problem writer: MikeMirzayanov

Tutorial

#### 1211I - Необычный граф

Problem writer: 300iq

Tutorial
• +29

 » 4 years ago, # | ← Rev. 8 →   +8 My solution to E: Double Permutation Inc. was similar to the reference solution (except I used sets rather than maps), but it turns out that calling .size on TreeSet.tailSet() is slow ($O(n \log n)$) and caused TLE. I submitted that in the last minute and would've got the T-shirt if it passed. Oh well...After contest time, I submitted a solution using BIT instead and it passed easily, but good to know there is a solution that doesn't require non-STL data structures.For F: kotlinkotlinkotlinkotlin..., isn't Fleury's algorithm too slow ($O(n^2)$)? I spent too much contest time implementing Hierholzer's algorithm from scratch as I never used it before. Handling linked-list-nodes is just so error-prone. However, after the contest time, I discovered that a mere ArrayDeque can also implement Hierholzer's by "rotating" the deque whenever you get stuck. (The deque then may need to be rotated again after the path is complete, so that it starts with vertex 0. It can be shown that you'd never need more than $n$ rotations in total.) Example code: #60237987. Great learning experience though.
•  » » 4 years ago, # ^ |   0 Fleury's algorithm works in $O(n+m)$, where $n$ is the number of vertices and $m$ is the number of edges in case of careful implementation.
•  » » » 4 years ago, # ^ |   +10 Is Wikipedia incorrect or outdated on this matter then? How do you efficiently find bridges during traversal?https://cs.stackexchange.com/questions/90068/optimizing-fleurys-algorithm-to-work-in-ove
•  » » » » 4 years ago, # ^ |   +3 I think you are right about Fleury's algorithm. Probably Mike's implementation is also the typical Euler tour algorithm (apparently known as Hierholzer).For the implementation, just maintain a global pointer for each adjacency list (so you have pointer for every 6 nodes). It shouldn't have to be real pointer but just an integer index. And implement edge removal by incrementing the pointer.
•  » » » » 4 years ago, # ^ |   +3 Oh, sorry. I agree with ko_osaga — it seems the popular Eulerian tour's algorithm is not Fleury's algorithm.
 » 4 years ago, # |   +13 I think the should be a small correction in editorial of D. It should be a>=b and not the other way round
•  » » 4 years ago, # ^ |   0 Thanks, it will be fixed soon.