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

J. Italian Data Centers

설명

An Italian data center consists of a set of servers, each colored green, white, or red, and a set of wires connecting them. Each wire connects two distinct servers and two servers are connected by at most one wire. Additionally, the data center is connected, i.e. there is a way to transmit information between any two servers through a sequence of wires. To judge all of the contestant submissions, SWERC has an Italian data center. Since every year the number of contestants doubles, the data center needs to grow to adapt to the extra load. To address this, SWERC builds a new data center based on the previous year’s one by following these steps: • For each server \(s\) in the old data center, the new data center contains two servers \(s_{1}\) and \(s_{2}\) of the same color as \(s\). A wire is placed connecting the two servers \(s_{1}\) and \(s_{2}\). • For each wire connecting servers \(s\) and \(t\) in the old data center: if \(s\) and \(t\) have the same color, then a wire is placed in the new data center connecting \(s_{1}\) and \(t_{1}\) and another wire connecting \(s_{2}\) and \(t_{2}\); otherwise, a wire is placed in the new data center connecting \(s_{1}\) and \(t_{2}\) and another one connecting \(s_{2}\) and \(t_{1}\). One can show that if the old data center is connected than the new data center is also connected. You are given the Italian data center that SWERC currently has, which contains \(n\) servers (indexed by 1, 2, . . . , \(n\)) and \(m\) wires connecting them. The organization wants to know how good their data center will be after \(k\) years, so you should determine the diameter of the data center SWERC will have in \(k\) years. The diameter of the data center is the largest distance between any two servers, i.e. the shortest number of wires that have to be used to transmit something between the two servers.

제약
입력 형식

The first line contains three integers \(n\), \(m\) and \(k\) (\(2 \le n \le 100\), \(n - 1 \le m \le n\)(\(n - 1\))/2, \(0 \le k \le 100\)) — the number of servers, the number of wires, and the number of years to consider. The second line contains \(n\) integers \(c_{1}\), \(c_{2}\), . . . , \(c_{n}\) (\(1 \le c_{i} \le 3\)) — \(c_{i}\) is the color of server \(i\) (where 1 stands for green, 2 for white and 3 for red). Each of the next \(m\) lines contains two integers \(s_{i}\) and \(t_{i}\) (\(1 \le s_{i}\), \(t_{i} \le n\)) — the two servers the \(i-th\) wire connects. It is guaranteed that the data center is connected, the endpoints of each wire are distinct, and that there are no repeated wires.

출력 형식

Print the diameter of SWERC’s data center after \(k\) years. Problem J: Italian Data Centers SWERC \(2022-2023\)

예제 1
입력
3 3 0
1 2 3
1 2
2 3
3 1
출력
1
예제 2
입력
3 3 1
1 2 3
1 2
2 3
3 1
출력
2
예제 3
입력
3 3 2
1 2 1
1 2
2 3
3 1
출력
3
예제 4
입력
8 14 100
3 3 2 2 1 2 2 1
2 7
1 5
7 8
4 6
2 8
1 8
2 6
6 7
1 6
1 4
3 5
1 3
4 5
5 7
출력
53
문제 정보

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

출처 ICPC SWERC 2022

평가 및 의견

J. Italian Data Centers

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

Log in to rate problems.

개별 의견

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

풀이 제출

J. Italian Data Centers

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