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

Checker

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

의견: 0

설명

“...fool \(me\) once, shame \(on\) — shame \(on\) you. Fool \(me\) — you can’t get fooled again.” – W.
In this task, we will observe regular polygons that have each of their \(N\) sides colored in one of three
colors and whose vertices are denoted from 1 to \(N\) in a clockwise order. A triangulaton of a polygon
is a decomposition of its area into a set of n\(on-ov\)erlapping triangles whose sides either lie on the sides
of the polygon or its internal diagonals. Of course, in this task, each of the diagonals used for polygon
triangulation is also colored in one of three colors.
The triangulation is said to be patriotic if each of its \(N - 2\) triangles has all three sides of different colors.
Your task is to determine whether a given polygon with its diagonals is triangulated and whether that
triangulation is patriotic.
Ulazni podaci
The frist line contains the number of subtask this particular test case belongs to (see the table in the
scoring section). If your solution doesn’t care about that, simply read the number and feel free to ignore
it.
The second line contains an integer \(N\) from the task description.
The third line contains an integer consisting of \(N\) digits which represent the colors of polygon sides. More
precisely, the first digit represents the color of side (1, 2), the second digit represents the color of side
(2, 3), and so on until the \(N-th\) digit which represents the color of side (N, 1). The colors will always be
denoted with digits 1, 2 and 3.
Each of the next \(N - 3\) lines contain a description of one diagonal in the form \(X\) \(Y\) \(C\), where \(X\) and \(Y\)
are polygon vertices and \(C\) is the color of the diagonal (\(1 \le X\), \(Y \le N\), \(1 \le C \le 3\)). Each line describes a
valid diagonal, i.e., vertices \(X\) and \(Y\) will neither be equal nor neighbouring.
Output
If the input polygon is not correctly triangulated, you should output "neispravna triangulacija"
(invalid triangulation in Croatian).
If the input polygon is correctly triangulated but the triangulation is not patriotic, you should output
"neispravno bojenje" (invalid coloring in Croatian).
If the input polygon is correctly triangulated and that triangulation is patriotic, you should output
"tocno" (correct in Croatian).
Scoring
Subtask
Score
Constraints
1
12
\(4 \le N \le 300\)
2
17
\(4 \le N \le 2000\)
3
23
\(4 \le N \le 2 \cdot 10^{5}\), the output is either neispravna triangulacija or tocno
4
23
\(4 \le N \le 2 \cdot 10^{5}\), the output is either neispravno bojenje or tocno
5
35
\(4 \le N \le 2 \cdot 10^{5}\)
Unlike the task Trobojnica from round 1, if your program correctly outputs the first line in each test case
of a certain subtask, you will score 100% of the points allocated for that subtask.

제약

Subtask
Score
Constraints
1
12
\(4 \le N \le 300\)
2
17
\(4 \le N \le 2000\)
3
23
\(4 \le N \le 2 \cdot 10^{5}\), the output is either neispravna triangulacija or tocno
4
23
\(4 \le N \le 2 \cdot 10^{5}\), the output is either neispravno bojenje or tocno
5
35
\(4 \le N \le 2 \cdot 10^{5}\)
Unlike the task Trobojnica from round 1, if your program correctly outputs the first line in each test case
of a certain subtask, you will score 100% of the points allocated for that subtask.

입력 형식
출력 형식

If the input polygon is not correctly triangulated, you should output "neispravna triangulacija"
(invalid triangulation in Croatian).
If the input polygon is correctly triangulated but the triangulation is not patriotic, you should output
"neispravno bojenje" (invalid coloring in Croatian).
If the input polygon is correctly triangulated and that triangulation is patriotic, you should output
"tocno" (correct in Croatian).

예제 1
입력
1
5
12113
1 3 3
2 5 2
출력
neispravna triangulacija
예제 2
입력
1
4
1212
1 3 2
출력
neispravno bojenje
예제 3
입력
1
7
1223121
1 3 3
3 5 1
5 7 3
7 3 2
출력
tocno
설명

Clarifications of examples:
1
2
3
4
5
1
2
3
4
1
2
3
4
5
6
7

문제 정보

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

출처 COCI 2019/2020 Contest 2

평가 및 의견

Checker

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

Log in to rate problems.

개별 의견

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

풀이 제출

Checker

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