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

Trokuti

설명

An undirected graph with \(6 \cdot N\) vertices and \(M\) edges is given. An additional property of the graph is
that it can be partitioned into \(2 \cdot N\) disjoint triangles.
Find \(N\) disjoint triangles in the graph.

제약
입력 형식

In the first line, there is a natural number \(T\) (\(1 \le T \le 100\)), which indicates the number of test cases.
This is followed by \(T\) blocks of data.
In the first line of each block, there are natural numbers \(N\) and \(M\) (\(1 \le N \le 300\), \(0 \le M \le 10^{6}\)).
In the next \(M\) lines, there are two natural numbers \(x\) and \(y\) (\(1 \le x\), \(y \le 6 \cdot N\)), which indicate that there
is an edge between vertices \(x\) and \(y\).
The sum of all values of \(N\) across all test cases will not exceed 300.

출력 형식

For each test case, output \(N\) lines, each line containing three natural numbers \(a\), \(b\), \(c\) (\(1 \le a\), b, \(c \le 6 \cdot N\)),
which indicate that the vertices \(a\), \(b\), and \(c\) form a triangle.

서브태스크
서브태스크점수설명

1

13점

\(M = 6 \cdot N\)

2

18점

\(N = 3\), \(T = 1\)

3

18점

\(N = 6\), \(T = 1\)

4

71점

No additional constraints.

예제 1
입력
1
1 6
1 2
2 3
1 3
4 5
4 6
5 6
출력
1 2 3
예제 2
입력
1
3 26
4 7
4 9
7 9
4 5
4 8
5 8
4 12
4 18
12 18
3 7
3 9
15 5
15 8
6 13
6 1
13 1
6 14
6 17
14 17
6 2
6 10
2 10
16 13
16 1
11 14
11 17
출력
1 6 13
3 7 9
4 5 8
문제 정보

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

출처 COCI 2024/2025 Contest 2

평가 및 의견

Trokuti

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

Log in to rate problems.

개별 의견

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

풀이 제출

Trokuti

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