USACO2023年12月美国计算机奥赛竞赛金奖组问题一—Flight Routes

Bessie recently discovered that her favorite pop artist, Elsie Swift, is performing in her new Eras Tour! Unfortunately, tickets are selling out fast, so Bessie is thinking of flying to another city to attend the concert. The Eras tour is happening in N(2≤N≤750) cities labeled 1…N, and for each pair of cities (i,j)
with i<j there either exists a single direct flight from i to j or not.

A flight route from city a to city b (a<b) is a sequence of k≥2 cities a=c1<c2<⋯<ck=b such that for each 1≤i<k, there is a direct flight from city ci to city ci+1. For every pair of cities (i,j) with i<j , you are given the parity of the number of flight routes between them (0 for even, 1 for odd).

While planning her travel itinerary, Bessie got distracted and now wants to know how many pairs of cities have direct flights between them. It can be shown that the answer is uniquely determined.

INPUT FORMAT (pipe stdin):

The first line contains N.

Then follow N−1 lines. The ith line contains Ni integers. The j th integer of the i
th line is equal to the parity of the number of flight routes from i to i+j.

OUTPUT FORMAT (pipe stdout):

Output the number of pairs of cities with direct flights between them.

SAMPLE INPUT:

3
11
1

SAMPLE OUTPUT:

2

There are two direct flights: 1→2 and 2→3. There is one flight route from 1
to 2 and 2 to 3, each consisting of a single direct flight. There is one flight route from 1 to 3(1→2→3).

SAMPLE INPUT:

5
1111
101
01
1

SAMPLE OUTPUT:

6
There are six direct flights 1→2,1→4,1→5,2→3,3→5,4→5. These result in the following numbers of flight routes:

Flight Route Counts:

dest
1 2 3 4 5

1 0 1 1 1 3
2 0 0 1 0 1
source 3 0 0 0 0 1
4 0 0 0 0 1
5 0 0 0 0 0

which is equivalent to the sample input after taking all the numbers (mod2).

SCORING:

Inputs 3-4: N≤6
Inputs 5-12: N≤100
Inputs 13-22: No additional constraints.
Problem credits: Benjamin Qi

扫码领取USACO试题答案+详细解析

咨询一对一备赛规划

2023年12月美国计算机奥赛USACO竞赛白金组问题三——Train Scheduling

**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 aisi, 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试题答案+详细解析

咨询一对一备赛规划

2023年12月美国计算机奥赛USACO竞赛白金组问题二——A Graph Problem

To improve her mathematical knowledge, Bessie has been taking a graph theory course and finds herself stumped by the following problem. Please help her!

You are given a connected, undirected graph with vertices labeled 1…N and edges labeled 1…M(2≤N≤2⋅105, N−1≤M≤4⋅105). For each vertex v in the graph, the following process is conducted:​

Let S={v}and h=0.

While |S|<N,​

1.Out of all edges with exactly one endpoint in S, let e be the edge with the minimum label.
2.Add the endpoint of e not in S to S.
3.Set h=10h+e.

Return h ( mod 109+7).

Determine all the return values of this process.​

INPUT FORMAT (pipe stdin):

The first line contains N and M .​Then follow M lines, the eth containing the endpoints (ae,be) of the eth edge (1≤ae<beN). It is guaranteed that these edges form a connected graph, and at most one edge connects each pair of vertices.

OUTPUT FORMAT (pipe stdout):

Output N lines, where the ith line should contain the return value of the process starting at vertex i.

SAMPLE INPUT:

3 2
1 2
2 3

SAMPLE OUTPUT:

12
12
21

SAMPLE INPUT:

5 6
1 2
3 4
2 4
2 3
2 5
1 5

SAMPLE OUTPUT:

1325
1325
2315
2315
5132

Consider starting at i=3. First, we choose edge 2, after which S={3,4} and h=2.Second, we choose edge 3, after which S={2,3,4}and h=23. Third, we choose edge 1, after which S={1,2,3,4} and h=231. Finally, we choose edge 5, after which S={1,2,3,4,5}and h=2315. The answer for i=3 is therefore 2315.

SAMPLE INPUT:

15 14
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15

SAMPLE OUTPUT:

678925929
678925929
678862929
678787329
678709839
678632097
178554320
218476543
321398766
431520989
542453212
653475435
764507558
875540761
986574081

Make sure to output the answers modulo 109+7.

SCORING:

Input 4: N,M≤2000
Inputs 5-6: N≤2000
Inputs 7-10: N≤10000
Inputs 11-14: ae+1=be
for all e
Inputs 15-23: No additional constraints.

Problem credits: Benjamin Qi

扫码领取USACO试题答案+详细解析

咨询一对一备赛规划

2023年12月美国计算机奥赛USACO竞赛白金组问题一——Cowntact Tracing

Farmer John has N (2≤N≤105) cows labeled 1…N, where the connections between cows are described by a tree. Unfortunately, there is a sickness spreading throughout.

Initially, some cows start off infected. Every night, an infected cow spreads the sickness to their neighbors. Once a cow is infected, she stays infected. After some amount of nights, Farmer John realizes that there is an issue so he tests his cows to determine who has the sickness.

You are given Q(1≤Q≤20) different values for the number of nights, each an integer in the range [0,N]
. For each number of nights, determine the minimum number of cows that could have started with the illness, or that the number of nights is inconsistent with the given information.

INPUT FORMAT (pipe stdin):

The first line contains N.

The next line contains a bit string of length N, where the ith bit is 1 if the ith cow is infected and 0 otherwise. At least one cow is infected.

The next N−1 lines contain the edges of the tree.

Then Q, followed by the Q values for the number of nights.

OUTPUT FORMAT (pipe stdout):

Q lines, the answers for each number of nights, or −1 if impossible.

SAMPLE INPUT:

5
11111
1 2
2 3
3 4
4 5
6
5
4
3
2
1
0

SAMPLE OUTPUT:

1
1
1
1
2
5

For the first four queries, one possibility is that just cow 3 started with the illness. For the fifth query (1 night), one possibility is that cows 2 and 4 started with the illness. For the sixth query (0 nights), one possibility is that all five cows started with the illness.

SAMPLE INPUT:

10
1111111111
1 2
2 3
2 4
2 5
2 6
6 7
7 8
8 9
9 10
11
0
1
2
3
4
5
6
7
8
9
10

SAMPLE OUTPUT:

10
3
2
1
1
1
1
1
1
1
1

For the first query (0 nights), one possibility is that all ten cows started with the illness. For the second query (1 night), one possibility is that cows 2, 7, and 9 started with the illness. For the third query (2 nights), one possibility is that cows 2 and 9 started with the illness. For the fourth to eleventh queries, one possibility is that just cow 7 started with the illness.

SAMPLE INPUT:

5
11100
1 2
2 3
3 4
4 5
6
0
1
2
3
4
5

SAMPLE OUTPUT:

3
1
1
-1
-1
-1

For the first query (0 nights), one possibility is that cows 1, 2, and 3 started with the illness. For the second query (1 night), one possibility is that just cow 2 started with the illness. For the third query (2 nights), one possibility is that just cow 1 started with the illness. For the fourth through sixth queries, there is no consistent possibility.

SCORING:

Inputs 4-5: N≤10
Inputs 6-8: All cows are infected.
Inputs 9-11: N≤400
Inputs 12-23: No additional restrictions.
Problem credits: Suhas Nagar and Brandon Wang

扫码领取USACO试题答案+详细解析

咨询一对一备赛规划

2023-24全赛季USACO竞赛时间&地点说明!USACO官方新规千万别踩坑!

对于那些对计算机科学充满热情并希望在该领域取得卓越成就的学生来说,USACO是一个不可错过的机会。通过积极参与USACO,学生们不仅能够提升自己的技能,还能够为自己的大学申请增色不少。

竞赛时间&地点

中国学生可以参加USACO的三场比赛以及US Open公开赛。这些比赛的单场时长通常在3-4小时之间,但没有统一的开始时间和地点限制。

对于这些比赛,学生可以在指定的时间窗口内(注意中美时差)登录USACO官网,选择适合自己的时间在线参赛。一旦学生进入试题页面,比赛就会开始计时。

USACO新规

① 禁止使用生成式人工智能

USACO官方明确表示,在比赛期间禁止使用生成人工智能,并且不允许美国学生使用VPN来隐藏自己的IP地址。

② 铂金级别固定参赛时间

对于参加白金级别比赛的美国学生,官方要求学生在同一时间参加竞赛,该时间窗口将从东部时间(ET)周五至周一,调整至周六中午开始。铂金级别的题目将从此时开始发布。

周六开始参加比赛的铂金级别学生,将会更受USACO竞赛官方认可,有更大几率会被邀请至训练营,参与选拔IOI国家队选手。

比赛3道题,4小时

英文环境,需要自行解读翻译

多少分能晋级?

在考试结束后将会出现考试成绩,每个赛季月都会公布分数线。

① 提交代码后系统会自动评分,每个问题的分值都是333.333分,总分是1000分。

② 如果获得满分,系统将会提示直接晋级。这意味着在本月比赛中可以挑战

更高难度的试题。如果没能获得满分,则需要等待分数线公布。

③ 在月赛考试结束后,会划出晋级分数线。如果成功晋级,可以在下个月比赛中参加更高级别的竞赛。

USACO学术活动长线备考班、冲刺班已开启,扫描文末二维码领取限时优惠及备赛真题资料~

USACO秋季课程 正在火热组班中

金牌导师&精编讲义“强强联手”

免费无门槛!美国计算机编程竞赛USACO是如何评分的?不同级别考什么?

现如今,学科竞赛遍地开花,每一科都有丰富的竞赛种类。然而,在众多竞赛中,计算机竞赛因其难度较大,并且参与人数相对较少。然而,随着申请赛道的日益“拥挤”以及计算机科学专业竞争的加剧,最近几年计算机竞赛逐渐成为越来越多学生的首选,而其中USACO(美国计算机奥林匹克竞赛)便是其中的“佼佼者”。

比赛等级(选手保留上一届的比赛级别)

– 青铜:选手一经注册USACO账号即为青铜级别

– 白银:选手通过青铜考试后即为白银级别

– 黄金:选手通过白银考试后即为黄金级别

– 白金:选手通过黄金考试后即为白金级别

竞赛考察内容

铜级:主要考察编程知识的掌握程度,大多数铜级的考题没有像高级别那样有很多效率问题。铜级要求大家能够解释一个编程问题;能够创建基本算法和逻辑;能够将自己的想法转化为代码。

银级:银级考试比铜级考试要难得多。涉及递归搜索、贪心算法等基本的问题求解技术;要了解最基础的数据结构概念,还会考察效率问题。

黄金:设计更复杂的标准算法(例如最短路径,动态规划等),要求大家熟练掌握数据结构,主要考察效率问题。

铂金:要求同学对算法有深入了解,能够熟练应用,能解决复杂问题、开放问题。

评测规则

USACO目前判分方式和NOI系列赛事相同,即依据程序所能正确求解的测试点数量按比例计分。对于各个测试点,一般题目会标注相应的时限要求和内存要求(如未具体标注,则C/C++默认时限2秒,Java/Python默认时限4秒,内存均默认256MB)。

以上为一个题目的评测示例,即最终包含了10个测试点,其中7个正确、3个超时——绿色表示正确,红色表示错误(x表示错误答案,t表示时间超限,!表示运行时错误或内存超限,e表示输出文件为空,m表示找不到输出文件)。

USACO学术活动长线备考班、冲刺班已开启,扫描文末二维码领取限时优惠及备赛真题资料~

USACO秋季课程 正在火热组班中

金牌导师&精编讲义“强强联手”

USACO新赛季赛程一文说清!参加USACO竞赛收割名校offer!

USACO是美国举办的一项计算机竞赛,规模庞大,非常适合理工科的学生参加。在竞赛中取得好成绩对于大家的申请非常有帮助。

USACO新赛季赛程

参赛对象:全球学生,不限制年龄,国籍

考试时长:考试时间为3~5小时

考试形式:在线编码提交

参赛语言:C、C++、Java、Python任选

晋级方式:满分1000分,通常600-800分会晋级下一个级别

赛程设置:月赛→公开赛→训练营(中国学生只能参加到公开赛)

晋级路径:青铜级→白银级→黄金级→铂金级,难度逐级递增。新注册的参赛选手需要从最低组别开始打起。

竞赛优势

收割名校offer

许多顶级大学,特别是计算机相关专业的学校,高度认可和重视USACO竞赛的成绩和获奖。在申请名校时,具有USACO黄金及以上奖项的参赛者将成为个人实力的有力证明!

助攻课内计算机课程

USACO竞赛的内容与AP的CSA和A Level的CS科目相关。通过学习和参加USACO竞赛,学生不仅可以轻松参加USACO铜牌组考试,还有机会获得AP CSA的满分5分和A Level CS的A*等成绩。

全方位能力提升

USACO竞赛的题目侧重于衡量学生解决问题的能力,涉及算法和实际应用。在解决问题的过程中,学生需要整合各种必要的知识,并以编程的方式控制计算机给出解答。这个过程可以有效提升学生解决问题的能力。

独立思考和问题解决能力

参加竞赛的学生需要独立思考相关知识点,运用各种能力设计和实现代码,并验证其正确性,反复迭代修正。这个过程在普通的学制教育中通常要到研究生阶段才有机会进行训练,而参加竞赛的学生从小就在这种方式下培养思维能力,对于专注力和独立解决问题的能力提升非常有帮助。

USACO秋季课程 正在火热组班中

金牌导师&精编讲义“强强联手”

USACO竞赛的获奖难度如何?USACO竞赛结果如何查询?

USACO在美国大学申请过程中具有非常高的含金量和竞争力,在比赛中取得优异成绩有助于申请美国的顶尖大学,特别是在计算机专业方面。越来越多进入哈佛、耶鲁、麻省理工学院、普林斯顿和康奈尔等顶尖大学的学生都曾参加过USACO,并且取得了非常出色的成绩。

目前,USACO竞赛在美国名校中非常受欢迎,但在中国选手中的影响力相对较小。然而,由于USACO竞赛的历史悠久和题目质量很高,它有可能在未来一两年内逐渐像AMC竞赛一样变得非常热门。

USACO竞赛的获奖难度如何?

USACO竞赛的获奖难度相对较高。根据历年的数据,能够晋级到白金级别的中国选手数量很少,通常只有几十人左。而在白金级别中获得满分的中国选手数量通常在0到10人之间。

USACO竞赛近些年参赛人数暴增,参考2022-2023赛季,中国参赛总人数为10399人,每场比赛中,中国参赛者占比在27%-36%之间,仅次于美国,位居第二。

月赛:初始注册USACO账号即可达到铜级,铜升银比率为15%, 白银升黄金比率为12%,黄金升铂金比率为8%。

正因为如此,USACO竞赛的含金量非常高,难度也非常大。然而,USACO竞赛的好处是比较开放,学生可以通过系统的辅导和训练来获得高分和快速晋级。通过一段时间的努力,获得白银和黄金级别是有可能的。

USACO竞赛结果如何查询?

代码提交后,系统会自动给出评分,如果拿到了满分,系统会提示直接晋级。

如果没有拿到满分,需要等待官方公布晋级分数线,每场月赛结束后一周内,官方会通过电子邮箱发放参赛选手的程序的评测结果。成功晋级就可以在下一场月赛中参加更高级别的竞赛,没有成功晋级只能在下一场月赛中继续在原组别中打比赛。

同时进入官网,点击Contests,在相应的页面上可以找到比赛的最终结果总结、测试数据、题目解析、比赛的简要分析及参赛选手的成绩统计。

USACO学术活动长线备考班、冲刺班已开启,扫描文末二维码领取限时优惠及备赛真题资料~

USACO秋季课程 正在火热组班中

金牌导师&精编讲义“强强联手”

USACO竞赛有何特点?USACO四大级别的考核知识点一文汇总!

USACO作为国际奥林匹克信息学竞赛(IOI)美国国家队的预选比赛,逐渐成为全球信息学竞赛爱好者参与的一项重要赛事。

USACO竞赛流程

USACO为个人赛,学生可自主报名参赛。(具体报名流程点击此处了解。)在每次月赛指定的日期范围内的任何一个时间打开USACO题目完成考试即可,比赛需在规定时间内完成3-4道题目,每次考试满分1000分

USACO竞赛有何特点?

门槛低:USACO没有学校和地区级别的限制,任何学生都可以通过互联网参加,而且没有报名费。这使得USACO竞赛对于有兴趣的学生来说更加开放和包容。

赛程短:USACO竞赛是按照月度赛程进行的,每个月有一次比赛。如果学生具备足够的能力,通过一次月赛就有机会冲击最高奖项。相对于其他长期的竞赛,USACO的赛程相对较短,更加紧凑。

出分快:USACO竞赛在学生提交程序后会立即给出测试结果和得分,即时反馈学生的表现。这种实时的评估和反馈可以帮助学生及时了解自己的水平和进步情况。

难度高:USACO竞赛分为铜、银、金、黄金四个等级,难度逐级递增。随着级别的提升,题目的难度和复杂性也会增加,对学生的算法知识和编程能力提出更高的要求。USACO的难度较高,挑战性较大,对于喜欢数学和计算机科学的学生来说是一个很好的锻炼机会。

考核知识点

青铜级别比赛

分支和循环,嵌套可变循环,列表、函数、二维列表,基础数组, 多重循环,复合判断、枚举算法

白银级别比赛

基本数据结构、贪心、递归、递推等基本算法

黄金级别比赛

堆、栈、树、链表等高级数据结构,动态规划等高级算法,算法时间和空间复杂度

铂金级别比赛

各类高级的数据结构,尤其是需要算法的时间和空间复杂度,总分1000分。每道题333.3分。

USACO学术活动长线备考班、冲刺班已开启,扫描文末二维码领取限时优惠及备赛真题资料~

USACO秋季课程 正在火热组班中

金牌导师&精编讲义“强强联手”

USACO信息学奥赛不同级别难度如何?对能力有什么要求?

USACO是一项针对全世界高中信息学选手的竞赛,与国内的NOI(全国青少年信息学奥林匹克竞赛)地位相当。该竞赛目的在于选拔优秀的学生参加国际信息学奥林匹克竞赛(IOI),历届获得金牌及以上奖项的参赛者都备受计算机强校争相争取,成为他们眼中的香饽饽。因此,这也深受申请美本藤校学生的热衷。

USACO竞赛是一项免费比赛,学生只需要在官网注册一个账号即可参加。每场比赛的时间限制为3-5小时,从学生打开试题后开始计时。在比赛中,学生可以连续晋级。如果学生在当前级别的比赛中获得满分,系统会立即提示晋级到下一个级别。如果没有获得满分,学生可以等待考试结束后公布分数线,确认是否晋级到下一个级别。

青铜级别比赛:

   - 难度:对大部分学生来说,难度一般。

   - 能力要求:学生需要掌握基本的编程知识,包括语法、控制流程、变量和函数等。不需要太难的算法知识,主要考察基本的编程能力和理解能力。

白银级别比赛:

  - 难度:适中。

   - 能力要求:学生需要掌握简单的算法知识,了解基础的数据结构,如数组、链表和栈等。需要具备解决实际问题的能力,能够分析问题、设计算法和实现代码。

黄金级别比赛:

  - 难度:较高。

   - 能力要求:学生需要具备一定的算法基础,能够理解一些抽象的问题,并能够应用常见的算法解决问题。此外,对数据结构也要有比较深入的了解,包括树、图和堆等。需要能够设计和实现复杂的算法。

铂金级别比赛:

   - 难度:非常高。

  - 能力要求:该级别是USACO中非常有难度的一个部分。学生需要对算法知识有非常深入的了解,并且具备很好的编程能力。需要能够优化算法,提高效率,并且能够应对复杂的问题和挑战。

USACO学术活动长线备考班、冲刺班已开启,扫描文末二维码领取限时优惠及备赛真题资料~

USACO秋季课程 正在火热组班中

金牌导师&精编讲义“强强联手”