포럼
문제 ICPC00359

F. Failing Factory

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

The gigafactory for your new range of Battery-Assisted Postal Cars is finally up and running. This manufacturing plant is a highly complex facility, consisting of many individual steps, where the parts of each car are milled, stamped, welded, soldered, screwed, glued, assembled, tested, detailed, layered, painted, and cleaned. Every step is optimized to the tiniest detail, making them very complicated.

As you are preparing for a visit from your main investor, alarm bells start going off. One of the steps failed, causing a cascade of failures across the factory! After hurriedly resolving the failures, panic creeps up to you: what if a failure happens during the visit of the investor?

Currently, all processes in the factory are working, but your engineers determined that each of them has some independent probability of failing before the visit. As the visit is soon, there will be no time for any repairs, and as soon as a step fails, this will quickly halt all dependent steps as well.

Thus, you decide to show only a single processing step of your factory, and specifically, the one with the smallest probability of failing. As an example, consider the second sample case. The probability that step \(1\) fails is \(0.72\), but step \(2\) is slightly more stable with a failure probability of \(0.6\). Thus, you show step \(2\) to your investor, with a probability of \(0.4\) that it will not fail.

제약
입력 형식

The input consists of:
- One line with two integers \(n\) and \(m\) (\(1 \leq n \leq 10^5\), \(0 \leq m \leq 10^5\)), the number of steps and the number of dependencies between steps.
- One line with \(n\) floating point numbers \(p\) (\(0 \leq p \leq 1\)), the individual failure probability of each step. Each probability is given in decimal form[1] with exactly three digits after the decimal point. [1] When a floating-point number is written in decimal form, it is not in scientific notation.
- \(m\) lines, each with two integers \(a\) and \(b\) (\(1 \leq a, b \leq n\), \(a \neq b\)), indicating that step \(a\) depends on step \(b\): failure of step \(b\) will cause failure of step \(a\).

A direct dependency of one step on another occurs at most once.

Cyclic dependencies are allowed.

출력 형식

For the step with the smallest probability of failing, output the probability that it will not fail.

Your answer should have an absolute error of at most \(10^{-200}\) or a relative error of at most \(10^{-6}\).

예제 1
입력
2 2
0.600 0.300
1 2
2 1
출력
0.28
예제 2
입력
2 1
0.300 0.600
1 2
출력
0.4
예제 3
입력
4 3
0.999 0.994 0.998 0.996
1 2
2 3
3 4
출력
0.004
예제 4
입력
4 4
0.999 0.994 0.998 0.996
1 2
2 3
3 4
4 1
출력
4.8e-11
문제 정보

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

출처 ICPC BAPC 2024

평가 및 의견

F. Failing Factory

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

Log in to rate problems.

개별 의견

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

풀이 제출

F. Failing Factory

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