29 lines
720 B
Python
29 lines
720 B
Python
from abc import ABC, abstractmethod
|
|
from typing import Any, Dict, List
|
|
|
|
class BaseProblem(ABC):
|
|
"""
|
|
Abstract base class for all algorithm problems.
|
|
"""
|
|
|
|
@abstractmethod
|
|
def generate_case(self, **kwargs) -> Dict[str, Any]:
|
|
"""
|
|
Generate a random test case based on parameters.
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def solve(self, input_data: Any, algorithm: str) -> Any:
|
|
"""
|
|
Solve the problem using the specified algorithm.
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def verify(self, input_data: Any, result: Any) -> bool:
|
|
"""
|
|
Verify the correctness of the result (optional, or compare with standard answer).
|
|
"""
|
|
pass
|