2023-2024賽季的USACO考試已于12月18日正式結(jié)束,晉級(jí)賽的最新試題也已經(jīng)公布。近日,USACO官方公布了2023-2024賽季首場月賽的晉級(jí)分?jǐn)?shù)線。如果沒有晉級(jí),12月可以當(dāng)做一個(gè)練手+熟悉賽制的環(huán)節(jié),1、2月的月賽持續(xù)發(fā)力,USACO可以重復(fù)挑戰(zhàn)。
今天給大家分享白金級(jí)試題和解析,參賽的同學(xué)來看看解題思路,沒參賽的同學(xué)來看看難度如何?
USACO 2023年12月白金級(jí)第三題
**Note:The memory limit for this problem is 512MB, twice the default.**
Bessie has taken on a new job as a train dispatcher! There are two train stations:A and B. Due to budget constraints, there is only a single track connecting the stations. If a train departs a station at time t, then it will arrive at the other station at time t+T(1≤T≤1012).
There are N (1≤N≤5000) trains whose departure times need to be scheduled. The i th train must leave station si at time ti or later (si∈{A,B},0≤ti≤1012). It is not permitted to have trains going in opposite directions along the track at the same time (since they would crash). However, it is permitted to have many trains on the track going in the same direction at the same time (assume trains have negligible size).
Help Bessie schedule the departure times of all trains such that there are no crashes and the total delay is minimized. If train i is scheduled to leave at time ai≥si, the total delay is defined as ![]()
INPUT FORMAT (pipe stdin):
The first line contains N and T.
Then N lines follow, where the ith line contains the station si,
and time ti corresponding to the ith train.
OUTPUT FORMAT (pipe stdout):
The minimum possible total delay over all valid schedules.
SAMPLE INPUT:
1 95
B 63
SAMPLE OUTPUT:
0
The only train leaves on time.
SAMPLE INPUT:
4 1
B 3
B 2
A 1
A 3
SAMPLE OUTPUT:
1
There are two optimal schedules. One option is to have trains 2,3,4 leave on time and train 1 leave after a one-minute delay. Another is to have trains 1,2,3 leave on time and train 4 leave after a one-minute delay.
SAMPLE INPUT:
4 10
A 1
B 2
A 3
A 21
SAMPLE OUTPUT:
13
The optimal schedule is to have trains 1and 3 leave on time, train 2 leave at time 13, and train 4 leave at time 23. The total delay is 0+11+0+2=13.
SAMPLE INPUT:
8 125000000000
B 17108575619
B 57117098303
A 42515717584
B 26473500855
A 108514697534
B 110763448122
B 117731666682
A 29117227954
SAMPLE OUTPUT:
548047356974
SCORING:
Inputs 5-6: N≤15
Inputs 7-10: N≤100
Inputs 11-14: N≤500
Inputs 15-18: N≤2000
Inputs 19-24: No additional constraints
Problem credits: Brandon Wang
部分代碼截圖:

USACO歷年真題及參考書,掃碼領(lǐng)取!【翰林提供報(bào)名指導(dǎo)服務(wù)】
USACO歷年真題及參考書

2023-2024年USACO活動(dòng)時(shí)間
第一次月賽:2023年12月15日-18日
第二次月賽:2024年1月26日-29日
第三次月賽:2024年2月16日-19日
美國公開賽:2024年3月15日-18日
(中國學(xué)生只能參加到公開賽)
集訓(xùn)營:2024年5月23日-6月1日
EGOI:2024年7月21日-27日(荷蘭)
IOI:2024年9月1日-8日(埃及)
報(bào)名方式:參賽者可隨時(shí)在官網(wǎng)注冊(cè)賬號(hào),注冊(cè)。報(bào)名,只需在活動(dòng)時(shí)間登陸完成答題即可。
官網(wǎng)地址:usaco.org
提交之后,官網(wǎng)會(huì)發(fā)送一份郵件到您郵箱,郵件中有賬號(hào)密碼
利用已知的賬號(hào)于密碼,登錄USACO賬號(hào),即可開始考試

? 2025. All Rights Reserved. 滬ICP備2023009024號(hào)-1