Input (stdin)
An order message is a request to trade shares:
order <timestamp> <security> <client> <goal> <participation rate>
New fields:
- client: alphabetical string
- goal: total number of shares to trade
- participation rate: positive integer; the maximum percentage of the security’s trailing-minute traded volume (excluding this order) that this order may constitute
Order rules
- An order is filled when the goal quantity has been traded.
- An order expires after 1 minute.
- An order is active until filled or expired.
- A client can have at most one active order per security.
✅ Output (stdout)
After receiving an order at time T, emit prints:
print T' S <quantity> <price>
Following constraints:
- Timestamps must be non-decreasing, and T’ ≥ T
- Orders expire: T’ < T + 60
- For the trailing minute ending at T’:
emitted_volume / external_volume <= participation_rate - Quantity must be positive integer
- Total emitted quantity ≤ goal
- Price = most recently observed market print price for S
✅ Example
print 5 SILVER 100 8
order 11 SILVER ALICE 100 10
print 12 SILVER 200 9
print 90 SILVER 200 10
Output
print 11 SILVER 10 8
print 12 SILVER 20 9
Explanation:
- At time 11: trailing volume = 100 → can emit 10 shares
- At time 12: trailing volume = 300 → can emit 20 shares
- After time 12, no more prints; order eventually expires at 71
✅ Summary
This problem simulates an execution algorithm constrained by:
✅ Trailing-minute external traded volume
✅ Participation rate limits (PR)
✅ Expiration of orders
✅ Partial fills
✅ Market prints updating price and volume
You must compute at each timestamp:
- The latest market price
- External volume last 60 seconds
- Allowed trading quantity =
floor(PR% * external_volume) - Ensure quantities are positive and within goal
- Emit prints with correct timestamps and prices
This closely resembles a simplified real-world broker execution algorithm.
The VOprep team has long accompanied candidates through various major company OAs and VOs, including Voleon, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Tiktok or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.