← 返回 nvidia 的题目列表Simple VM Manager
类型:online_judge
Write a simple VM manager that can list, add, modify, and delete virtual machines (VMs). Each VM contains a list of attributes. Errors should be handled, such as duplicate or non-existent IDs.
Example test cases:
Input: Add VM with ID 1, attributes {"name": "vm1", "cpu": "2 cores", "memory": "4 GB"} Output: Successfully added
Input: Add VM with ID 1 Output: Error, ID already exists
Input: Delete VM with ID 2 Output: Error, ID does not exist
Data scale:
Up to 10,000 VMs allowed at the same time
No more than 10 attributes per VM
Please ensure error handling for each command.
Example
Input
add 1 {"name": "vm1", "cpu": "2 cores", "memory": "4 GB"}