RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00600

Hiperkocka

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

...it’s dark \(in\) the cube, it’s dark \(in\) the cube...
Five in the morning. Daniel wakes up, he opens his eyes. His head hurts a bit. He can still hear the
ringing in his ears.
He comes to realize that he has found himself at a playground, in a big metal box.
...I was \(in\) the cube, \(I\) was \(in\) the cube...
He remembers a similar situation he found himself in, three years ago, COCI round 2, task Kocka.
...I’m \(in\) the cube again, I’m \(in\) the cube again...
But this time, things are much more complicated... Daniel is in an \(n-di\)mensional hipercube \(Q@@RISE_MATH_BLOCK_0@@n\) is a graph with nodes 0, 1, . . . \(2^{n} - 1\), in which nodes \(x\) and \(y\) are connected if
and only if their bitwise xor is a power of two.
A tree can be placed on the hipercube so that:
• each node of the tree corresponds to some node of the hipercube
• those nodes have to be distinct
• if there is an edge between two nodes in the tree, then there has to be an edge between the
corresponding nodes in the hipercube.
A tiling of the hipercube is done by placing several trees so that each edge of the hipercube belongs to at
most one tree.
Your task is to tile the hipercube \(Q\)\(n\) with as many copies of the given tree \(T\) , which has \(n\) edges.

제약

If your solution correctly places \(k\) trees, you will receive \(f\)(\(k\)) · 110 points for that test case, where
\(f\)(\(k\)) =
(
0.\(7 \cdot k/2^{n}\){−}
if \(k < 2^{n}\){−}
1
if \(k = 2^{n}\){−}.
Of course, if your solution is not correct, you will receive 0 points.
Your total number of points is equal to the minimum number of points your solution receives over all of
the test cases.
It is possible to prove that there always exists a solution which uses all of the \(2^{n}\){−} trees.

입력 형식

The first line contains a positive integer \(n\) (\(1 \le n \le 16\)), the dimension of the hipercube.
Each of the following \(n\) lines contains two integers \(x\) and \(y\) (\(0 \le x\), \(y \le n\), \(x\)̸ = \(y\)) which denote that the
nodes \(x\) and \(y\) are connected by an edge in tree \(T\) .

출력 형식

In the first line print the number of trees in your tiling.
Each of the following lines should describe a placement of a single copy of the tree \(T\) .
In the \(i-th\) line print \(n + 1\) numbers \(a\){(}}^{)
0 ^{, a}{(}}^{)
1 ^{. . . a}{(}}^{)
\(n\) ^{.} ^{These} ^{numbers} ^{denote} ^{that} ^{the} {i}} ^{tree} ^{is} ^{placed} ^{so
that the hipercube node \(a\){(}}^{)
\(j\)
corresponds to the tree node \(j\), for all \(j = 0\), . . . , n.

예제 1
입력
1
0 1
출력
1
0 1
예제 2
입력
2
0 1
1 2
출력
2
0 1 3
0 2 3
예제 3
입력
3
0 1
0 2
0 3
출력
4
0 1 2 4
3 1 2 7
5 1 4 7
6 2 4 7
설명

Clarification of the third example:

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2021/2022 Contest 2

평가 및 의견

Hiperkocka

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Hiperkocka

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8