Problem p03136 - Generation 1

Orig Description

Score : 200 points
Problem StatementDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.
You can use the following theorem:
Theorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
Constraints
All values in input are integers.
3 \leq N \leq 10
1 \leq L_i \leq 100
InputInput is given from Standard Input in the following format:
N
L_1 L_2 ... L_N
OutputIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.
Sample Input 14
3 8 5 1
Sample Output 1Yes
Since 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.
Sample Input 24
3 8 4 1
Sample Output 2No
Since 8 \geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.
Sample Input 310
1 8 10 5 8 12 34 100 11 3
Sample Output 3No

Extracted Specification

An integer N (3 ≤ N ≤ 10), representing some quantity or size.
A list of integers L of size N, where each integer is between 1 and 100.

### Example Input:

```
4
3 8 5 1
```

### Function Signature:
Write a function f(N, L) that takes in the input. 
def f(N: int, L: List[int]): 
    ''' 
    N: an integer 
    L: a list of integers
    '''

Test Case Generator

Sure! Here is a Python function to generate random test cases for the given problem statement:

```python
import random

def tcgen():
    # Constraint for the number of sides
    N = random.randint(3, 10)
    
    # Constraint for the length of each side
    L = [random.randint(1, 100) for _ in range(N)]
    
    return N, L

# To print a generated test case
if __name__ == "__main__":
    N, L = tcgen()
    print(N)
    print(' '.join(map(str, L)))
```

This `tcgen` function will generate test cases adhering to the constraints specified in the problem statement. It randomly selects a number of sides between 3 and 10 and then generates side lengths between 1 and 100 for each side. When executed, it will print a random test case in the format required by the problem statement.

Here are a few example outputs of the test case generator:

Example Output 1:
```
7
15 23 42 8 27 14 36
```

Example Output 2:
```
4
10 24 35 12
```

Example Output 3:
```
9
5 10 7 12 20 18 30 1 15
```

You can run the `tcgen` function multiple times to generate different test cases for your competitive programming problem.

Extract Arguments

def extract_arguments(fh):
    N = int(fh.readline().strip())
    L = list(map(int, fh.readline().strip().split()))
    return N, L