Скоро Codeforces Round 1133 (Div. 1, Div. 2)! Регистрация здесь. ×

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

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

6B - President's Office I submitted this solution — 69647174

What I am trying to do is to start dfs starting on the first cell of the president's table. If there is another table in that cell's neighbour i call the color function which is also dfs but on the deputy's table and increase the ans (res) by 1.

I do not know what is wrong in this approach. Can anyone help?

UPD: Solved thanks to CodingKnight

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

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

No need for dfs here.

Spoiler
»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

The following accepted solution is a C++17 version of your Java code with slight updates.

69660777

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

There's no need of dfs but then also I implemented it using graphs in C++ and got it accepted. U can find my submission here. 69730654