Question
A file hierarchy contains directories and files. Some files are already encrypted. You may encrypt an individual file or issue one recursive encryption request for an entire directory. Choose operations with minimum total time.
```python
class FileNode:
def __init__(self, is_encrypted: bool): ...
class DirectoryNode:
def __init__(self, children: list): ...
def count_files(node) -> tuple: ...
def min_encrypt_time(node, t_req: int, t_file: int) -> int: ...
```
## Requirements and cost model
- Encrypting one file costs `t_req + t_file`.
- Encrypting a directory costs `t_req + N * t_file`, where `N` is every file in its subtree, including already-encrypted files.
- A subtree with no unencrypted files costs `0`.
- At a directory, you may batch the whole subtree or solve its children independently.
`count_files` returns `(encrypted_count, unencrypted_count)`.
The input is a finite tree of `FileNode` and `DirectoryNode` objects, with boolean encryption flags, no cycles or shared nodes, and non-negative integer costs. Empty directories are valid. Return counts or minimum integer cost without changing the tree or encryption flags; this is planning, not executing encryption. `_file_counts` is an optional helper, not an assessed interface. The provided `run_case` builds nodes from JSON fixtures and converts count tuples to JSON arrays.
## Design discussion (not graded)
1. Return the chosen operations, not only their cost.
2. Support file paths and overlapping directory requests.
3. Add limited parallelism or a cap on request batch size.
4. Recompute efficiently after one file's encryption state changes.