#P4946. Analysis of a Simple Two-Terminal Circuit

    ID: 18187 Type: Default 1000ms 256MiB

Analysis of a Simple Two-Terminal Circuit

Analysis of a Simple Two-Terminal Circuit

The circuit is a two‐terminal network connecting node 1 and node 2. The circuit consists of multiple parallel components, where each component is either an ideal voltage source or an ideal resistor. It is guaranteed that there is at least one voltage source and at least one resistor, and all voltage sources provide the same voltage \(V_0\). Because the voltage sources are ideal and connected in parallel, the potential difference between node 1 and node 2 is \(V_0\).

Your task is to compute the maximum and minimum current flowing through the resistor components. The current through a resistor with resistance \(R\) is computed using Ohm's law as:

[ I = \frac{V_0}{R} ]

Print the maximum current and the minimum current among all resistors, each formatted to two decimal places.

Input Format:

  • The first line contains an integer \(m\) (with \(m \ge 3\)) representing the total number of components.
  • Each of the following \(m\) lines contains a description of a component in the format: u v type value, where u and v are the endpoints (always 1 and 2 in this problem), type is a character that is either V (for voltage source) or R (for resistor), and value is a positive real number representing the voltage (in volts) or resistance (in ohms) respectively.

Output Format:

  • Output two numbers separated by a space: the maximum resistor current and the minimum resistor current, each rounded to two decimal places.

Note: It is guaranteed that the voltage sources all have the same voltage.

inputFormat

The first line contains an integer \(m\) indicating the number of components.

Then \(m\) lines follow, each line containing:

1 2 type value

Here, type is either V (voltage source) or R (resistor), and value is a positive real number.

outputFormat

Output two numbers separated by a space: the maximum current and the minimum current among all resistor components, each formatted to two decimal places.

sample

5
1 2 V 10
1 2 R 5
1 2 R 2
1 2 R 10
1 2 R 4
5.00 1.00