2026年USACO竞赛重大新规深度解读!2026 USACO考题趋势分析!附USACO高效备赛三大妙招

美国计算机奥林匹克竞赛USACO作为全球最具影响力的中学生算法编程赛事,2026赛季迎来史上最严规则调整。这些变革不仅直接影响晋级路径,更重塑了全球选手的备赛策略。本文将全面解析 四大核心新规、2026考题趋势,并提供 三大科学备赛妙招,助你精准应对新赛季挑战。

一、2026 USACO四大关键新规:必须提前掌握!

规则1:黄金 & 铂金级“认证成绩”机制(最严时间窗口)

适用对象:仅限 Gold(黄金)和 Platinum(铂金) 级别选手

开赛时间窗口:

美国东部时间(ET)周六 12:00–12:15

北京时间:周日 01:00–01:15

特别提醒:

黄金→铂金晋级必须依赖认证成绩;

申请USACO官方训练营需至少3场认证成绩 + US Open认证成绩;

务必提前设闹钟!错过15分钟窗口=整月努力白费!

规则2:全面禁止生成式AI工具(史上最严反作弊)

严禁使用以下工具:

代码生成:ChatGPT、Claude、Gemini、通义千问等大模型;

代码补全:GitHub Copilot、Tabnine、通义灵码、讯飞星火等AI插件;

任何AI辅助调试或思路生成。

监管手段:

代码相似度检测 + 语法模式分析 + 异常提交行为监控;

处罚:一经查实,直接终身禁赛 + 所有历史成绩作废。

正确做法:

可请教老师/教练,但不能依赖AI代写或优化逻辑;

培养独立建模与调试能力,这才是USACO的核心考察点。

规则3:IP地址透明化(仅限美国学生)

要求:美国籍学生不得使用VPN/代理,必须通过家庭或学校真实IP参赛;

目的:防止代考、刷分,确保身份真实性;

中国学生不受此限制,但仍建议使用稳定网络环境,避免断网导致提交失败。

二、2026 USACO考题趋势:难度升级,思维为王

尽管规则趋严,题目本身也持续进化。

趋势总结:

铜组已涉及DP、位运算等传统银/金级内容;

题目强调问题转化能力,而非单纯套模板;

“暴力模拟”不再万能,需思考时间复杂度优化。

三、USACO高效备赛三大妙招(2026新版)

妙招1:系统梳理算法知识图谱

级别 核心算法重点
Bronze 模拟、枚举、贪心、基础排序/搜索、简单字符串处理
Silver DFS/BFS、二分查找、前缀和、基础DP、STL(vector/map/set)
Gold 图论(最短路、最小生成树)、高级DP(区间/树形)、数据结构(并查集、线段树)
Platinum 网络流、平衡树、数位DP、计算几何、数学构造

妙招2:手写经典算法模板库

不要复制粘贴! 必须亲手编写并调试以下模板:

快速幂、并查集、Dijkstra、Floyd、Kruskal

01背包、LIS、LCS、区间DP

线段树(单点/区间更新)、SOS DP

目的:

确保比赛时零调试时间;

深化对算法边界条件的理解。

妙招3:精研近五年真题 + 错题复盘

推荐资源:

官网历年真题(2021–2026)

USACO Forum 讨论区(看高分选手解法)

刷题方法:

限时模拟考试(4小时);

对照官方题解,分析思路差距;

建立“错题本”,记录:

错误类型(TLE / WA / 思维盲区)

正确解法核心思想

可复用的技巧(如“离散化”“状态压缩”)

备赛的同学可扫码免费领取新赛季USACO全套干货资料⇓

USACO一对一辅导规划!

USACO vs NOI/NOIP全方位对比!哪个难度更高?升学价值有何不同?

在信息学竞赛领域,USACO(美国计算机奥林匹克) 与 NOI(全国青少年信息学奥林匹克竞赛)及其前置赛 NOIP 是两条最具影响力的赛道。一条通向哈佛、MIT、斯坦福等世界顶尖理工院校,另一条直指清华、北大、中科大等国内C9名校强基/综评录取。

本文将从 赛事定位、赛制规则、难度对标、考察重点、升学价值 五大维度,全面对比 USACO 与 NOI/NOIP,并为不同背景的学生提供精准参赛建议。

一、赛事简介:目标与定位

项目 USACO(美国计算机奥林匹克) NOI / NOIP(中国信息学奥赛体系)
主办方 美国官方(非营利组织) 中国计算机学会(CCF)
参赛对象 全球中小学生,免费开放,无国籍限制 中国在校中学生,需通过学校/省队选拔
核心目标 选拔美国IOI国家队;服务全球学生学术成长 选拔中国IOI国家队;服务国内高校招生
语言支持 C++、Java、Python(推荐C++) 仅限C++
费用 全程免费 NOIP报名费约50–100元,NOI费用较高

关键区别:

USACO 是开放式、低门槛、高弹性的全球平台;

NOI 是封闭式、高门槛、强选拔性的国家级精英通道。

二、赛制与晋级路径对比

USACO:灵活进阶,四次机会

级别:Bronze → Silver → Gold → Platinum(四级递进)

比赛频率:每年4场月赛 + 1场US Open(2026年起取消线上Open,仅保留线下邀请赛)

晋级机制:

满分 → 当场晋级;

非满分 → 赛后按全球排名划线(通常700+/1000分可晋级);

2026新规:每场最多升一级,Gold/Platinum需美东周六12:00准时开赛才计认证成绩。

容错率高:一次失利,下月可再战。

NOI/NOIP:一年一考,步步惊心

路径:CSP-J/S(入门/提高) → NOIP(省级联赛) → 省选 → NOI(全国决赛)

NOIP赛制:

初赛:笔试(选择题+填空),考察基础知识广度;

复赛:上机编程(4题,5小时),考察算法深度;

关键限制:

一年仅一次机会;

初赛未过 → 无缘复赛;

复赛未达省一 → 基本无缘清北强基。

现实压力:

国内选手常因“初试失误”或“状态波动”错失全年机会,而USACO提供多次试错空间。

三、难度对标:中美竞赛能力映射

根据历年真题与选手表现,USACO与国内赛事存在以下近似对应关系:

USACO 级别 对应国内水平
Bronze → Silver CSP-J 第二轮二等奖
Silver → Gold CSP-J 一等奖 / CSP-S 低分一等奖
Gold → Platinum CSP-S 一等奖 / NOIP 中高分一等奖
Platinum 高分 NOI 银牌以上 / IOI 金牌水平

说明:

USACO Platinum 顶尖选手已具备国际金牌实力;

NOIP 一等奖(约前2000人)是清北“强基计划”信息学类最低门槛。

四、考察重点差异:记忆 vs 灵活

维度 USACO NOI/NOIP
题型风格 高度灵活,强调建模与创新 相对固定,套路题较多(如树剖、网络流模板)
知识要求 “少而精”:掌握核心算法并能灵活组合 “广而深”:需覆盖大量数据结构与算法模板
初赛环节 无笔试,纯上机编程 有初赛,考察计算机基础、数学、逻辑等理论知识
解题自由度 可用任何合法方法(只要正确) 常需使用“标准解法”,否则难拿高分
AI/工具使用 严禁AI(2026起严查) 允许使用标准库,但禁用外部帮助

USACO优势:

不靠死记硬背,重在理解本质 + 灵活应用,更适合培养真实编程能力。

五、升学价值:国内外路径分化

出国留学 → 首选 USACO

黄金/铂金证书被 MIT、Stanford、CMU、Caltech 等校高度认可;

在Common App、UC系统中可作为核心学术成就填写;

铂金级甚至可替代部分AP Computer Science成绩。

国内升学 → 必须冲 NOIP/NOI

NOIP 一等奖:

清华“新领军”、北大“筑梦计划”、中科大少年班直接入围;

复旦、上交、浙大等校强基计划破格资格;

NOI 金牌:保送清北(无需高考)。

现实策略:

计划出国 → 主攻USACO,NOIP可作为辅助;

留在国内 → 必须全力备战NOIP,USACO可作兴趣拓展。

备赛的同学可扫码免费领取新赛季USACO全套干货资料⇓

USACO一对一辅导规划!

USACO 四大组别详解:从青铜到铂金的进阶路径与能力要求

美国计算机奥林匹克竞赛(USACO)采用四级递进式赛制:Bronze(青铜)→ Silver(白银)→ Gold(黄金)→ Platinum(铂金)。选手必须依次通过各级别,不可跳级,但若实力足够,可在单场比赛中连续晋级(如青铜满分直接升白银,再满分可继续挑战黄金——注:2026年起每场最多升一级)。本文将系统解析每个组别的参赛资格、核心考点、难度特征与学习建议,助你科学规划备赛路径。

一、青铜组(Bronze)—— 编程入门者的起点

参赛资格

所有新注册选手默认从青铜开始,无需前置条件。

考察内容

基础语法:变量、条件分支、循环(嵌套/可变)、函数

数据结构:一维/二维数组(列表)、字符串

基础算法:

枚举(暴力搜索)

简单模拟(如日期计算、游戏规则模拟)

偶尔涉及:前缀和、贪心策略(作为“思维题”而非模板)

难度分析

不强制要求算法知识,重在逻辑建模与代码实现能力;

题目通常可暴力求解(O(n²) 或 O(n³) 可接受);

学习建议

掌握 C++ 基础语法(或 Python 快速上手);

练习 100+ 道 Bronze 真题,培养“读题→建模→编码”闭环;

重点训练:边界处理、输入输出格式、调试能力。

二、白银组(Silver)—— 算法思维的奠基阶段

参赛资格

通过青铜组比赛(达到晋级分数线或满分)。

考察内容

类别 核心知识点
数据结构 栈、队列、优先队列(堆)、哈希表(map/set)、前缀和/差分数组
算法技巧 贪心、二分查找、双指针(尺取法)、排序优化、简单递归
搜索 DFS(深度优先)、BFS(广度优先),含基础剪枝
动态规划 简单线性DP(如LIS、背包变种)

难度分析

从“能写”转向“写得聪明”:

暴力不再可行,需优化时间复杂度(如 O(n²) → O(n log n));

强调问题转化能力(如将实际问题抽象为图/BFS模型);

学习建议

精通 STL 容器(vector, set, map, priority_queue);

掌握 二分答案、双指针、BFS/DFS 模板;

刷 Silver 真题 50+ 道,重点分析“为什么不能暴力”。

三、黄金组(Gold)—— 综合算法能力的试金石

参赛资格

通过白银组比赛。

考察内容

领域 高频考点
高级数据结构 并查集(DSU)、树状数组(Fenwick Tree)、线段树(Segment Tree)
图论 最短路(Dijkstra/Floyd)、最小生成树(Kruskal/Prim)、拓扑排序
动态规划 区间DP、树形DP、状态压缩DP(Bitmask)
搜索优化 折半搜索(Meet-in-the-Middle)、IDA*(启发式搜索)
数学基础 基础数论(GCD、快速幂)、组合计数(容斥原理)

难度分析

多知识点融合成为常态:

“动态规划 + 线段树优化转移”
“并查集维护连通性 + 贪心选择边”

代码复杂度显著提升:需处理大量边界与细节;

部分题目接近IOI难度,强调建模创新性。

学习建议

手写 核心模板库(并查集、线段树、Dijkstra);

系统学习 图论与DP专题;

参加 Codeforces Div2/3 比赛保持手感;

精读 Gold 真题官方题解,理解“最优解思路”。

四、铂金组(Platinum)—— 顶尖算法高手的竞技场

参赛资格

通过黄金组比赛。

考察内容

无固定考纲,难度无上限,常见方向包括:

高级数据结构:平衡树(Treap/Splay)、后缀自动机(SAM)、Link-Cut Tree

复杂算法:网络流(Dinic/EK)、数位DP、莫队算法、FFT

数学与构造:博弈论、生成函数、复杂组合恒等式

非常规思维题:无标准算法,依赖创造性建模

难度分析

题目设计极具开放性:

同一题可能有多种解法(如 DP vs 贪心 vs 数学推导);

强调时空复杂度极致优化(常卡常数);

全球仅数百人稳定在铂金,是冲击USACO国家集训营(Camp) 的唯一通道。

学习建议

深入研究 IOI/ICPC 历年真题;

参与 Codeforces Div1 / AtCoder Grand Contest;

加入 算法讨论社区(如 USACO Forum、Codeforces Blog);

目标:不仅能解题,更能设计新算法。

五、进阶路线图与关键提醒

备赛节奏建议

时间 目标
0–3个月 Bronze → Silver(掌握基础算法)
3–9个月 Silver → Gold(攻克DP与图论)
9–18个月+ Gold → Platinum(突破高级数据结构与创新思维)

终极建议

不要等晋级后再学下一级内容!

在刷 Bronze 时,可同步学习 Silver 的二分/BFS;

在 Gold 阶段,提前接触 Platinum 的线段树优化技巧。

超前学习 + 真题实战 = 稳步晋级的核心公式。

备赛的同学可扫码免费领取新赛季USACO全套干货资料⇓

USACO一对一辅导规划!

2026 年 2 月比赛——最终结果

USACO 2026赛季的第二场比赛采用了涵盖多种技术和难度等级的算法编程问题。

在为期四天的比赛中,共有9854名不同用户登录。共有7031名参与者提交了至少一个解决方案,来自100+个不同国家。3203名参与者来自美国,中国、加拿大、韩国、马来西亚、新加坡和印度的参与度也较高。

总共有19463份评分提交,按语言分类如下:

12569 C++17
2981 Python-3.6.9
1983 Java
1816 C++11
100 C
14 Python-2.7.17

顺便说一句,我们正在努力增加对PyPy的支持,以帮助Python选手在计算要求更高的问题上获得更高分数。

以下是白金、金、银和铜三项比赛的详细成绩。 你还可以找到每个问题的解决方案和测试数据。

USACO 2026年 第二场 比赛,白金奖

白金组共有180名参与者,其中141名是大学预科生。与赛季首场比赛一样,白金题目极具挑战性,美国参赛者得分超过500分的美国选手不到十人。顶尖竞争者的结果将在学术诚信审核结束后公布。

1 Circle of Cows
查看问题 | 测试数据 | 解决方案
2 Cow Circle
查看问题 | 测试数据 | 解决方案
3 Dynamic Instability
查看问题 | 测试数据 | 解决方案

USACO 2026年 第二场 比赛,金奖

黄金组共有1366名参赛者,其中962名为在校生。我们的教练团队仍在进行学术诚信审核,审核结果可能影响晋级分数线——该分数线将在审核流程完成后尽快公布

1 Balancing the Barns
查看问题 | 测试数据 | 解决方案
2 Lexicographically Smallest Path
查看问题 | 测试数据 | 解决方案
3 The Chase
查看问题 | 测试数据 | 解决方案

USACO 2026年 第二场 比赛,银奖

银级共有2721名参赛者,其中1964名为预科生。本次竞赛中得分700分及以上的选手将自动晋升至金级。

1 Cow-libi 2
查看问题 | 测试数据 | 解决方案
2 Declining Invitations
查看问题 | 测试数据 | 解决方案
3 Farmer John Loves Rotations
查看问题 | 测试数据 | 解决方案

USACO 2026年 第二场 比赛,铜奖

铜牌组共有5137名参赛者,其中3876名是大学预科生。所有在本次比赛中获得700分或更高分数的参赛者将自动晋升为银牌组。

1 It's Mooin' Time IV
查看问题 | 测试数据 | 解决方案
2 Moo Hunt
查看问题 | 测试数据 | 解决方案
3 Purchasing Milk
查看问题 | 测试数据 | 解决方案

结语

2025-26赛季现在正在顺利进行,在宣布有监督的美国公开赛邀请之前,只剩下一场比赛了。总的来说,本赛季的第二场比赛非常成功,但有一个技术问题——在“认证”黄金/白金窗口结束时,负载激增,导致部分用户出现不必要的速度减慢(我们正在调查原因,并采取措施在未来缓解类似情况)。在赛季开始时,黄金组的绝大多数顶级竞争对手都开始了比赛,很高兴看到有相当多的人成功晋升回白金级别。铜组和银组也出现了大量晋升;祝贺所有在本赛季取得进步的人!

对于尚未晋升的人, 记住,练习越多,效果越好 你的算法编程技能将变得——拜托 继续努力!USACO比赛设计上甚至挑战了非常 最优秀的学生,这需要相当多的努力 要在这些领域出类拔萃。为了帮助你修复代码中的任何漏洞,你现在可以重新提交你的解决方案并获得反馈 使用“分析模式”评判服务器。

2026 年 USACO竞赛 第二场比赛铜奖组问题三—Purchasing Milk

On National Milk Day, Farmer John is offering exclusive prices on buckets of milk! He has N (1≤N≤105) deals numbered from 1 to N. For the i'th deal, he is offering 2i−1 buckets of milk for ai (1≤ai≤109,ai<ai+1) moonies. The same deal may be taken any non-negative integer number of times.

You are thinking about Q (1≤Q≤104 ) independent queries. For each query, you have an integer x (1≤x≤109) in mind and wonder what is the minimum cost to purchase at least x buckets of milk.

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains two integers N and Q.

The following line contains a1,a2,…,aN.

Each of the following Q lines contains an integer x, representing a query.

OUTPUT FORMAT (print output to the terminal / stdout):

For each query, output the minimum cost on a new line.

Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).

SAMPLE INPUT:

2 4
10 15
1
2
6
7

SAMPLE OUTPUT:

10
15
45
55

In the example above, Farmer John is offering 2 deals: 1 bucket of milk for 10 moonies and 2 buckets of milk for 15 moonies.

The cheapest cost to buy 1 bucket is just the cost of the 1 bucket deal and the cheapest cost to buy 2 buckets is just the cost of the 2 bucket deal.

To get 6 buckets, the cheapest way is to purchase 3 of the 2 bucket deal for a total of 45 moonies.

To get 7 buckets, the cheapest way is to purchase 3 of the 2 bucket deal and 1 of the 1 bucket deal for a total of 55 moonies.

SAMPLE INPUT:

4 10
10 25 30 70
1
2
3
4
5
6
7
8
15
101

SAMPLE OUTPUT:

10
20
30
30
40
50
60
60
120
760

In this example, Farmer John is offering a total of 4 deals for 1, 2, 4, and 8 buckets. For each of the 10 queries, the corresponding output indicates the minimum cost to purchase at least that amount of milk. Sometimes, it is cheaper to purchase more than the specified amount.

SCORING:

Inputs 3-4: N≤2
Inputs 5-8: N≤10
Inputs 9-16: No additional constraints.

Problem credits: Chongtian Ma

2026 年 USACO竞赛 第二场比赛铜奖组问题二—Moo Hunt

Bessie is playing the popular game "Moo Hunt". In this game, there are N (3≤N≤20) cells in a line, numbered from 1 to N. All cells either have the character M or O with the i-th cell having character si.

Bessie plans to perform K (1≤K≤2⋅105) mooves. On her i-th moove, Bessie will tap 3 different cells (xi,yi,zi) (1≤xi,yi,ziN). Bessie will earn a point if  sxi=M
and syi=szi=O. In other words, Bessie will earn a point if she forms the string MOO by tapping cells xi,yi,zi in that order.

Farmer John wants to help Bessie get a new high score. He wants you to find the maximum possible score Bessie could get across all possible boards if she performs the K mooves as well as the number of different boards that will allow Bessie to achieve this maximum possible score. Two boards are different if there exists a cell such that the corresponding characters at the cell are different.

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains N and K, the number of cells and the number of mooves Bessie will perform.

Each of the next K lines contains xi,yi,zi describing Bessie's i-th move (xi,yi,zi are pairwise distinct).

OUTPUT FORMAT (print output to the terminal / stdout):

Output the maximum possible score Bessie could achieve, followed by the count of different boards that will allow Bessie to achieve this maximum score.

SAMPLE INPUT:

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

SAMPLE OUTPUT:

4 2

The boards MOOOM and MOOMM allow Bessie to achieve a maximum score of 4. In both boards, Bessie will earn points on mooves 1,2,5,6. It can be shown that this is the maximum score Bessie can achieve, and those two boards are the only possible boards allowing Bessie to achieve a score of 4.

SAMPLE INPUT:

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

SAMPLE OUTPUT:

6 3

The boards that allow Bessie to achieve a maximum possible score of 6 are OOMOOO, OOMMOO, and OOMOOM.

SCORING:

Inputs 3-5: N≤8,K≤104

Inputs 6-12: There will be one test for each N∈{14,15,16,17,18,19,20} with no  additional constraints on K.

Problem credits: Alex Liang

2026 年 USACO竞赛 第二场比赛铜奖组问题一—It's Mooin' Time IV

Bessie has a computer with a keyboard that only has two letters, M and O.

Bessie wants to type her favorite moo S consisting of N letters, each of which is either an M or an O. However, her computer has been hit with a virus. Every time she tries to type the letter O, every letter that she has typed so far flips, either from M to O or from O to M, before the O appears.

Is it possible for Bessie to type out her favorite moo?

Additionally, Bessie is given a parameter k which is either 0 or 1.

If k=0, then Bessie only needs to determine whether it is possible to type out her favorite moo.

If k=1, then Bessie also needs to give an example of a sequence of keystrokes to type so she can type out her favorite moo.

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains T, the number of independent test cases (1≤T≤104) and k
(0≤k≤1).

The first line of each test case has N (1≤N≤2⋅105).

The second line of each test case has S. It is guaranteed that no characters will  appear in S besides M and O.

The sum of N across all test cases will not exceed 4⋅105.

OUTPUT FORMAT (print output to the terminal / stdout):

For each test case, output either one or two lines using the following procedure.

If it is impossible for Bessie to type out S, print NO on a single line.

Otherwise, on the first line print YES. Furthermore, if k=1, on the second line,print a string of length N, the characters in order that Bessie needs to type in order to type out her favorite moo. If there are multiple such strings, any will be accepted.

SAMPLE INPUT:

2 0
3
MOO
5
OOMOO

SAMPLE OUTPUT:

YES
YES

SAMPLE INPUT:

2 1
3
MOO
5
OOMOO

SAMPLE OUTPUT:

YES
OMO
YES
MOOMO

As Bessie types out MOOMO, this is how the letters change:

1.Before typing the first M, Bessie has an empty string. Afterwards, she has the string M.

2.After typing the first O, the M flips to O, and then the O is appended to form OO.

3.After typing the second O, the OO flips to MM, and then the O is appended to form MMO.

4.After typing the second M, Bessie has the string MMOM.

5.After typing the last O, the string MMOM flips to OOMO, and then the O is  appended to form OOMOO, as desired.

SCORING:

Inputs 3-4: k=0.
Inputs 5-6: k=1,T≤103,N≤10.
Inputs 7-9: k=1,T≤10,N≤1000.
Inputs 10-16: k=1.

Problem credits: Nick Wu

2026 年 USACO竞赛 第二场比赛银奖组问题三—Farmer John Loves Rotations

Farmer John has an array A containing N integers (1≤N≤5⋅105,1≤AiN). He picks his favorite index j and take out a sheet of paper with only  Aj written on it. He can then perform the following operation some number of times:

Cyclically shift all elements in A one spot to the left or one spot to the right. Then, write down Aj on a piece of paper.

Let S denote the set of distinct integers that occur in A. Farmer John wonders what the minimum number of operations he must perform is so that the paper contains all integers that appear in S.

Since it is unclear what FJ's favorite index is, output the answer for all possible favorite indices 1≤jN. Note for each index, A is reset to its original form before performing any operations.

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains N.

The following line contains A1,A2,…,AN.

OUTPUT FORMAT (print output to the terminal / stdout):

Output N space-separated integers, where the i'th integer is the answer for his favorite index j=i.

SAMPLE INPUT:

6
1 2 3 1 3 4

SAMPLE OUTPUT:

4 3 3 4 3 3

The distinct numbers are S={1,2,3,4}. Suppose Farmer John’s favorite index is j=1. He starts off with A1=1 written on a piece of paper. We can track the array A after each cyclic shift Farmer John makes.

Cyclic shift right: FJ writes down A1=4.

4 1 2 3 1 3

Cyclic shift left: FJ writes down A1=1 again.

1 2 3 1 3 4

Cyclic shift left: FJ writes down A1=2.

2 3 1 3 4 1

Cyclic shift left: FJ writes down A1=3.

3 1 3 4 1 2

At this point, Farmer John has written down every number in S using 4 operations.

SAMPLE INPUT:

12
1 1 2 1 1 3 1 1 4 1 1 1

SAMPLE OUTPUT:

8 7 6 7 8 9 8 7 6 7 8 9

SCORING:

Inputs 3-5: N≤500
Inputs 6-8: N≤104
Inputs 9-17: No additional constraints.

Problem credits: Chongtian Ma

2026 年 USACO竞赛 第二场比赛银奖组问题二—Declining Invitations

N contestants participated in a contest, each placing a distinct rank from 1
to N. There are C criteria used to invite contestants to participate in the final round, and the ith-ranked contestant satisfies a specified ni of them (1≤ni ≤C).

The invitation process runs as follows. First, the top f1 students who satisfy the 1
st criteria will be invited. Then, out of all students who haven't yet been invited, the top f2 (or all remaining if there are fewer than f2 remaining) students who satisfy the 2nd criterion will be invited. This process repeats, for each i
from 1 to C (1≤fiN).

However, some contestants will decline to participate in the final round, in which case they will be ignored when determining who to invite.

You are given a permutation p1,p2,…,pN of 1…N. For each i from 0 to N−1, determine the sum of the ranks of the contestants who will be invited if the participants with ranks given by the first i elements of p decline to attend.

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains N and C (1≤N,C≤105).

The next line contains f1,f2,…,fC.

The next line contains p1…,pN.

The next N lines each contain ni (1≤niC), followed by ni distinct integers in [1,C], representing the criteria that the i th-ranked contestant satisfies. It is guaranteed that ∑ni≤106.

OUTPUT FORMAT (print output to the terminal / stdout):

Output N lines, the sum of ranks of invitees before each declination.

SAMPLE INPUT:

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

SAMPLE OUTPUT:

6
6
9
6
4

There is only one criterion. The top three remaining contestants who have not declined will be invited.

SAMPLE INPUT:

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

SAMPLE OUTPUT:

10
14
12
9
5

Initially, the ith contestant gets invited under criterion i for all 1≤i≤4.

After the first declination, the i+1th contestant gets invited under criterion i for all 1≤i≤4.

SAMPLE INPUT:

6 10
5 6 4 1 3 3 3 6 5 3
1 4 6 5 2 3
1 9
5 4 3 9 5 10
10 6 2 10 1 7 8 3 9 4 5
10 4 5 3 1 2 9 10 6 7 8
2 3 1
8 1 9 7 4 3 10 6 2

SAMPLE OUTPUT:

21
20
16
10
5
3

SCORING:

Inputs 4-6: N,C≤103,∑ni≤104
Inputs 7-8: C=1
Inputs 9-10: C=2
Inputs 11-16: No additional constraints.

Problem credits: Benjamin Qi

2026 年 USACO竞赛 第二场比赛银奖组问题一—Cow-libi 2

Farmer John and Farmer Nhoj have taken their respective cows to sit around a campfire in hopes of settling their personal differences. In total, there are N
(2≤N≤105) cows sitting in a circular formation. When the farmers are ready to take their cows back to their farms, they realize one crucial mistake: since all the cows look the same and are mixed up, they are unable to identify which cows belong to which farmer!

Then the N cows are organized into one straight line to be interrogated by the two farmers. Because of the confusion, the order of the cows in the line, from 1
to N, might not correspond to their circular order around the campfire.

But the cows want to play a game. Instead of answering directly which farmer they belong to, they say which farmer the cows adjacent to them in the original circle belong to. Additionally, it is known that Farmer Nhoj's cows always lie but Farmer John raised his cows well and they will always tell the truth.

Given the statements of the cows, is it possible to assign each cow to either Farmer John or Farmer Nhoj such that the statements of the cows assigned to Farmer John are all true, and the statements of the cows assigned to Farmer Nhoj are all false?

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains T (1≤T≤1000), the number of independent test cases, and an integer C∈{0,1} (whether to output a construction or not).

The first line of each test case contains N.

The following line contains a string of length N containing characters J or N. The i'th character is J if cow i claims the cow to their left in the circle belongs to Farmer John, or Farmer Nhoj otherwise.

The following line contains a string of length N containing characters J or N. The i'th character is J if cow i claims the cow to their right in the circle belongs to Farmer John, or Farmer Nhoj otherwise.

It is guaranteed that the sum of N over all tests does not exceed 5⋅105.

OUTPUT FORMAT (print output to the terminal / stdout):

For each test case, output YES or NO.

Additionally, if C=1 and the answer is YES, output two more lines describing your construction:

The first line should contain a permutation p1,p2,…,pN of 1…N, representing the circular order of the cows around the campfire, where cow pi is to the left of cow pi+1 for i in 1…N−1, and cow pN is to the left of cow p1.

The second line should contain a string b1b2…bN consisting only of Js and Ns, meaning that cow pi belongs to Farmer John if bi is J, or Farmer Nhoj otherwise.

Any valid construction will be accepted.

SAMPLE INPUT:

6 0
3
JJJ
JJJ
4
JJNJ
NJJJ
6
NJNJNJ
JNNJNJ
4
NNNN
NNNN
3
NNN
NNN
5
JJNNJ
NJNJJ

SAMPLE OUTPUT:

YES
NO
NO
YES
NO
YES
SAMPLE INPUT:
6 1
3
JJJ
JJJ
4
JJNJ
NJJJ
6
NJNJNJ
JNNJNJ
4
NNNN
NNNN
3
NNN
NNN
5
JJNNJ
NJNJJ

SAMPLE OUTPUT:

YES
1 2 3
JJJ
NO
NO
YES
1 2 3 4
NJNJ
NO
YES
4 5 2 1 3
JJJJN

Consider the output for the sixth test case. Cows 1, 2, 4, 5 belong to Farmer John, and Cow 3 belongs to Farmer Nhoj.

The cows will then behave as follows:

Cow 1's left and right neighbours are Cow 2 and Cow 3, respectively. Cow 1 says that Cow 2 belongs to Farmer John, and Cow 3 belongs to Farmer Nhoj.

Cow 2's left and right neighbours are Cow 5 and Cow 1, respectively. Cow 2 says that both cows belong to Farmer John.

Cow 3's left and right neighbours are Cow 1 and Cow 4, respectively. Cow 3 (dishonestly) says that both cows belong to Farmer Nhoj.

Cow 4's left and right neighbours are Cow 3 and Cow 5, respectively. Cow 4 says that Cow 3 belongs to Farmer Nhoj, and Cow 5 belongs to Farmer John.

Cow 5's left and right neighbours are Cow 4 and Cow 2, respectively. Cow 5 says that both cows belong to Farmer John.

All these claims are consistent with the input.

SCORING:

Input 3: C=0 and N≤10
Input 4: C=1 and N≤10
Inputs 5-8: C=0
Inputs 9-12: C=1

Problem credits: Chongtian Ma

在线咨询
联系客服