Archipelago

Archipelago

Moderate+

您知道吗,斯德哥尔摩是一座建在 14 个岛屿上的城市,有 57 座桥梁连接着梅拉伦湖和波罗的海。

给您一张长方形的岛屿地图,每个岛屿上的数字表示有多少座桥与之相连。

example

游戏的目的是按照以下规则,根据桥梁的数量将所有岛屿连接起来:

  • 同一方向上的桥梁不能超过两座;
  • 桥梁只能是垂直或水平的,不能跨越岛屿或其他桥梁;
  • 完成后,地图上的所有岛屿都由桥梁相互连接,可以从任何一个岛屿通往另一个岛屿。

您的函数必须返回一个按升序排序的带有桥梁的方向元组。每个方向都是一个包含三个整数的元组。前两个整数是岛屿的序号(升序排序),第三个整数是这两个岛屿之间的桥梁数(1 或 2)。岛屿必须从 1 开始排序,从左上到右下,行-主。

example

输入整数元组 (int).

输出:由三个整数组成的元组 (int).

例子

assert archipelago(
...
You should be an authorized user in order to see the full description and start solving this mission.
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission