Orig Description
Activity Selection Problem
There are $n$ activities with start times $\{s_i\}$ and finish times $\{t_i\}$. Assuming that a person can only work on a single activity at a time, find the maximum number of activities that can be performed by a single person.
Input
$n$
$s_1$ $t_1$
$s_2$ $t_2$
:
$s_n$ $t_n$
The first line consists of the integer $n$. In the following $n$ lines, the start time $s_i$ and the finish time $t_i$ of the activity $i$ are given.
Output
Print the maximum number of activities in a line.
Constraints
$1 \le n \le 10^5$
$1 \le s_i \lt t_i \le 10^9 (1 \le i \le n)$
Sample Input 1
5
1 2
3 9
3 5
5 9
6 8
Sample Output 1
3
Sample Input 2
3
1 5
3 4
2 5
Sample Output 2
1
Sample Input 3
3
1 2
2 3
3 4
Sample Output 3
2
Extracted Specification
An integer N (1 ≤ N ≤ 10^5), representing some quantity or size.
A list of N tuples, each containing two integers (s_i, t_i) where (1 ≤ s_i < t_i ≤ 10^9).
### Example Input:
```
5
1 2
3 9
3 5
5 9
6 8
```
### Function Signature:
Write a function f(inputs) that takes in the input.
def f(inputs: List[Tuple[int, int]]):
'''
inputs: a list of tuples, each tuple containing two integers
'''
Test Case Generator
Sure! Below is a test case generator for the Activity Selection Problem:
```python
import random
def tcgen():
# Number of activities
n = random.randint(1, 10**5)
activities = []
for _ in range(n):
# Ensuring start time is less than finish time
s = random.randint(1, 10**9 - 1)
t = random.randint(s + 1, 10**9)
activities.append((s, t))
return n, activities
# Example usage
if __name__ == "__main__":
n, activities = tcgen()
print(n)
for s, t in activities:
print(s, t)
```
### Explanation
1. **Number of Activities (n)**:
- `n` is generated randomly within the range [1, 10^5].
2. **Activity Times**:
- For each activity, a start time `s` is generated randomly within the range [1, 10^9 - 1].
- A finish time `t` is generated such that it is greater than the start time `s` and within the range [s + 1, 10^9].
3. **Output**:
- The function returns `n` and a list of tuples, where each tuple contains the start and finish times of an activity.
4. **Example Usage**:
- The script prints the generated test case in the required format.
This generator will create a variety of test cases within the specified constraints. You can run the script to generate different test cases and use them for testing your solution to the Activity Selection Problem.
Extract Arguments
def extract_arguments(fh):
n = int(fh.readline().strip())
activities = []
for _ in range(n):
s, t = map(int, fh.readline().strip().split())
activities.append((s, t))
return n, activities