RampOA #1
Banking System I (Top Spenders + Scheduled Payments + Merge)
估计困难评测数据准备中,可先阅读题面
Implement a simplified version of a banking system. All operations have a timestamp parameter (stringified ms, range 1 to 10⁹, strictly increasing).
Level 1 — Account Creation, Deposit, Transfer
create_account(timestamp, account_id) -> booldeposit(timestamp, account_id, amount) -> int | Nonetransfer(timestamp, source_account_id, target_account_id, amount) -> int | None
Level 2 — Top Spenders
top_spenders(timestamp, n) -> list[str]— topnaccounts by highest outgoing total (transfer source + pay). Format"account_id(total_outgoing)". Tiebreak alphabetically.
Level 3 — Scheduled Payments with 2% Cashback
pay(timestamp, account_id, amount) -> str | None— withdrawamount. Provides 2% cashback (rounded down) refunded 24 hours later (86_400_000ms). Returns"payment{ordinal}". Cashback processes before any other transaction at its refund timestamp.get_payment_status(timestamp, account_id, payment_id) -> str | None—"IN_PROGRESS"or"CASHBACK_RECEIVED".
Level 4 — Account Merging with Balance History
merge_accounts(timestamp, account_id_1, account_id_2) -> bool— mergeaccount_id_2intoaccount_id_1. Pending cashbacks for account 2 still refund to account 1. Queries with oldpayment_idmust still work via account 1.get_balance(timestamp, account_id, time_at) -> int | None— historical balance after operations attime_at.