← 返回 openai 的题目列表Chatbot Channel: Multi-bot Message Router
类型:online_judge
Problem: Multi-bot Message Router in a Channel (AwayBot/TacoBot/MeetBot)
A chat channel contains three bots: awayBot, tacoBot, and meetBot. When a user sends a message, if it is a bot message (e.g., mentions a bot using @ or another specified format), the system should trigger the corresponding bot(s) to produce automatic responses.
Implement a simplified bot message router/handler:
Input: a time-ordered stream of message events.
Processing: determine which bot(s) are triggered per message and what response each bot should generate.
Output: print/return the bot responses in correct order (possibly multiple responses per user message).
Requirements (abstracted)
A single user message may trigger 0 to multiple bots.
Each bot has its own trigger rule and response format (provided in the interview).
If multiple bots are triggered by the same message, output responses in the specified priority order.
Handle multiple messages while preserving overall output ordering.
Input format (confirm in interview)
Line 1: integer n, number of messages.
Next n lines: each a message record, possibly like:
user_id: message_text
or structured fields such as timestamp user_id message_text
Output format
For each input message, output 0 or more lines of bot responses (ordered by bot priority and time).
Constraints (confirm in interview)
1 <= n <= 1e5
message length <= 1e3
Example (placeholder)
Because the exact bot rules are not fully specified in the post, the example only illustrates the I/O shape; trigger rules and response strings follow the interviewer’s specification.
Input
3
u1: @tacoBot lunch?
u2: hi
u3: @awayBot I will be OOO
Output
<tacoBot response>
<awayBot response>
Example
Input
3
u1: @tacoBot lunch?
u2: hello everyone
u3: @awayBot OOO today
Output
<tacoBot response>
<awayBot response>