포럼
문제 ICPC00317

I. In Case of an Invasion, Please...

설명

-7mm

-15mm

After Curiosity discovered not just water on Mars, but also an aggressive, bloodthirsty bunch of aliens, the Louvain-la-Neuve municipal government decided to take precautionary measures; they built shelters in order to shelter everyone in the city in the event of an extraterrestial attack.

Several alien-proof shelters have been erected throughout the city, where citizens can weather an alien invasion. However, due to municipal regulations and local building codes the shelters are limited in size. This makes it necessary for the government to assign every citizen a shelter to calmly direct themselves towards in the rare event of a fleet of UFOs blotting out the sun. Conditional on no shelter being assigned more people than it can fit, it is of the utmost importance that the time it takes until everyone has arrived at a shelter is minimized.

We model Louvain-la-Neuve as a network of \(n\) locations at which people live, connected by \(m\) bidirectional roads. Located at \(s\) points throughout the city are the shelters, each with a given maximum capacity. What is the minimum amount of time it takes for everyone to arrive at a shelter, when we assign people to shelters optimally?

The Louvain-la-Neuve municipal government has made sure that there is enough shelter capacity for its citizens and all shelters can be reached from any location, i.e. it is always possible to shelter everyone in some way.

제약
입력 형식
  • On the first line are three integers, the number of locations \(1 \leq n \leq 10^5\), roads \(0 \leq m \leq 2\cdot 10^5\), and shelters \(1 \leq s \leq 10\).
  • Then follows a line with \(n\) integers \(0 \leq p_i \leq 10^9\), indicating the the number of people living at location \(1 \leq i \leq n\).
  • Then follow \(m\) lines containing three integers \(1 \leq u, v \leq n\) and \(1 \leq w \leq 10^9\) indicating that there is a bidirectional road connecting \(u\) and \(v\) that takes \(w\) time to traverse. For any two locations there is at most one road connecting them directly, and no road connects a location to itself.
  • Finally follow \(s\) lines with two integers \(1 \leq s_i \leq n\) and \(1 \leq c_i \leq 10^9\), indicating that there is a shelter with capacity \(c_i\) at location \(s_i\).
출력 형식

Print the minimum amount of time it takes to shelter everyone.

예제 1
입력
2 1 1
3 2
1 2 4
1 6
출력
4
예제 2
입력
4 5 2
2 0 0 2
1 2 6
1 3 2
2 3 3
3 4 4
4 2 6
3 2
2 2
출력
5
예제 3
입력
7 8 3
0 1 1 1 1 0 2
1 2 1
2 3 1
3 1 1
4 6 5
4 3 1
6 7 10
7 5 3
5 6 3
6 5
1 1
2 1
출력
6
예제 4
입력
2 1 1
0 2
1 2 1000000000
2 2
출력
0
문제 정보

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

출처 ICPC BAPC 2018

평가 및 의견

I. In Case of an Invasion, Please...

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

Log in to rate problems.

개별 의견

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

풀이 제출

I. In Case of an Invasion, Please...

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