Logo
(追記) (追記ここまで)

32899번 - Kruidnoten 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 (추가 시간 없음) 2048 MB97514452.381%

문제

Every week, Karlijn and her teammates join the competitive programming training at their university. Thinking and coding for such a long time is quite exhausting, and they need a ton of snacks to get through training. They have divided the chore of bringing snacks neatly: while the other two bring stroopwafels and salt sticks, Karlijn's duty is to provide kruidnoten.

She usually gets them on the way from home to university just before training. The bicycle network in her home town consists of intersections which are connected by cycleways of different lengths. The intersections are numbered from 1ドル$ to $n$. Karlijn's house is at intersection 1ドル,ドル and her university is at intersection $n$.

There are multiple stores that sell kruidnoten, but some of them are often out of stock. Karlijn wants to get to university as quickly as possible, so she has a habit of looking up online which stores still have kruidnoten before leaving her house. Using this information, she then takes the shortest path via some stocked store. An example is visualized in Figure K.1.

Figure K.1: A possible situation from Sample Input 1, where not every store is stocked with kruidnoten. In this case, Karlijn buys the kruidnoten at the store at intersection 3ドル,ドル and the shortest path has length 11ドル$.

Now, she wonders how much time she should usually plan for her way to training. From long-time experience, Karlijn knows for each store how likely it is that they have not sold out. In particular, she observed that the stock of kruidnoten is independent for each store. What is the expected length of a shortest path from Karlijn's house to university if she wants to visit some store that has kruidnoten in stock?

입력

The input consists of:

  • One line with three integers $n,ドル $m,ドル and $k$ (2ドル\leq n\leq 2 \cdot 10^5,ドル 1ドル\leq m\leq 2 \cdot 10^5,ドル 1ドル\leq k\leq n$), the number of intersections, cycleways, and stores that may sell kruidnoten.
  • $m$ lines, each with three integers $i,ドル $j,ドル and $\ell$ (1ドル\leq i, j\leq n,ドル $i \neq j,ドル 1ドル \leq \ell \leq 10^6$), indicating that the intersections $i$ and $j$ are connected by a cycleway of length $\ell$. It is guaranteed that every pair of intersections is connected by at most one cycleway. Further, it is possible to get from every intersection to every other intersection by bike.
  • $k$ lines, each with one integer $i$ (1ドル\leq i \leq n$) and one floating-point number $p$ (0ドル < p \leq 1$ with at most four digits after the decimal point), indicating that there is a store located at intersection $i,ドル and that the probability that it still has kruidnoten is $p$. It is guaranteed that there is at most one kruidnoten store at each intersection.

출력

If the event that Karlijn cannot get any kruidnoten on her way has probability $> 0,ドル output "impossible". Otherwise, output the expected length of a shortest path from her home to university if she gets kruidnoten on the way.

Your answer should have an absolute or relative error of at most 10ドル^{-6}$.

제한

예제 입력 1

5 5 3
1 2 6
3 1 4
4 5 2
1 4 1
3 4 5
2 1.0
3 0.4
5 0.1

예제 출력 1

12.36

예제 입력 2

6 5 2
1 2 1
1 3 1
4 5 3
5 6 1
6 3 2
1 0.6283
4 0.3142

예제 출력 2

impossible

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2024 K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /