#C13593. Event Management System

    ID: 43148 Type: Default 1000ms 256MiB

Event Management System

Event Management System

This problem requires you to implement a simple event management system to manage events and their participants. You need to support various operations such as adding an event, updating an event, deleting an event, adding a participant to an event, updating or removing a participant, querying events based on given criteria, searching events by keyword, and exporting an event summary.

The operations you implement should support the following commands. Some commands produce output which must be printed immediately as described in the output section.

You must implement the system to read from standard input and write to standard output.

inputFormat

The first line contains a positive integer N, the number of commands. Each of the following N lines contains a command in one of the following formats:

  • ADD_EVENT event_id event_name event_date organizer
  • UPDATE_EVENT event_id name date organizer (use '-' for fields that are not updated)
  • DELETE_EVENT event_id
  • ADD_PARTICIPANT event_id participant_id name email
  • UPDATE_PARTICIPANT event_id participant_id name email (use '-' for fields that are not updated)
  • REMOVE_PARTICIPANT event_id participant_id
  • QUERY_EVENT field value (field can be one of: event_id, name, organizer, date)
  • SEARCH_EVENTS keyword
  • EXPORT_SUMMARY

All IDs are integers. The date is given in the format YYYY-MM-DD. It is guaranteed that the inputs are valid.

outputFormat

For commands that require producing output:

  • QUERY_EVENT and SEARCH_EVENTS: For each matching event, print a line in the format: event_id event_name event_date organizer.
  • EXPORT_SUMMARY: For each event (sorted by increasing event_id), first print a line with the event details in the format: event_id event_name event_date organizer. Then, for each participant (sorted by increasing participant_id), print a line with two leading spaces followed by: participant_id name email.
## sample
7
ADD_EVENT 1 MusicConcert 2023-10-15 Alice
ADD_PARTICIPANT 1 101 John_Doe john@example.com
QUERY_EVENT event_id 1
UPDATE_EVENT 1 MusicFestival - -
QUERY_EVENT name MusicFestival
REMOVE_PARTICIPANT 1 101
EXPORT_SUMMARY
1 MusicConcert 2023-10-15 Alice

1 MusicFestival 2023-10-15 Alice 1 MusicFestival 2023-10-15 Alice

</p>