~2023年USACO竞赛铜组考题难度如何?附USACO竞赛历年真题免费领取

时间:2023-05-15 13:42:38  作者:犀牛教育 来源:犀牛教育

2023年USACO月赛已经结束了,打算参加2023年12月份USACO竞赛的小伙伴不妨来看看USACO竞赛的考题的难度如何?今天我们就一起来看看吧 

2023 USACO公开赛铜组P1

数理逻辑题,需注意问题转化

 

P1题目:

P1 FEB:

Bessie and Elsie are plotting to overthrow Farmer John at last! They plan it out over (1 <= N <= 2 * 10 ** 5) text messages. Their conversation can be represented by a string S of length N where Is is either B or E, meaning the ith message was sent by Bessie or Elsie, respectively.

 

However, Farmer John hears of the plan and attempts to intercept their conversation. Thus, some letters of S are F, meaning Farmer John obfuscated the message and the sender is unknown.

 

The excitement level of a non-obfuscated conversation is the number of times a cow double-sends - that is, the number of occurrences of substring BB or EE in S. You want to find the excitement level of the original message, but you don’t know which of Farmer John’s messages were actually Bessie’s / Elsie’s. Over all possibilities, output all possible excitement levels of S.

 

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

The first line will consist of one integer N.

The next line contains S

 

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

 

First output K, the number of distinct excitement levels possible. On the next K lines, output the excitement levels, in increasing order.

 

SAMPLE INPUT:

4

BEEF

 

SAMPLE OUTPUT:

2

1

2

 

SAMPLE INPUT:

9

FEBFEBFEB

 

SAMPLE OUTPUT:

2

2

3

 

SAMPLE INPUT:

10

BFFFFFEBFE

 

SAMPLE OUTPUT:

3

2

4

6

 

SCORING:

      • Inputs 4-8: N ≤ 10

      • Inputs 9-20: No additional constraints.

题目解析
 
 
 

USACO竞赛的第一道题目需要分析出题目的性质,分为F左右都有元素和F只有一边有元素进行讨论,问题转化之后就比较简单了。

 
 

考虑每一段"XFF...FFY"可以产生多少贡献

 

结论是如果X=Y,能产生0,2,4,6,...的贡献

 

否则能产生1,3,5,7,...的贡献

 

对于下面的情况,整体减一可以得到和上面一样的结论

 

再考虑边缘,FF...FFY可以产生多少贡献

 

发现能产生0,1,2,...的贡献

 

于是我们可以分别统计这两种,加上初始答案即可

 
 

代码如下:

 
#include <iostream>

 

using namespace std;#define rep(i,h,t) for (int i=h;i<=t;i++)#define dep(i,t,h) for (int i=t;i>=h;i--)int n;char s[200010];bool t[200010];int main(){    scanf("%d",&n);    scanf("%s",s+1);    int O=0;    rep(i,1,n)      if (s[i]==s[i-1]&&s[i]!='F') O++;    int Q1=0,Q2=0;    rep(i,1,n)    {        if (s[i]=='F')        {            int j=i;            while (s[j]=='F'&&j<=n) j++;            j--;            int num=j-i+1;            if (i!=1&&j!=n)            {                if (s[i-1]==s[j+1]) num++;                O+=num%2;                Q1+=num/2;            } else Q2+=num;            i=j;        }    }    rep(i,0,Q1)      rep(j,0,Q2)        t[i*2+j+O]=1;    int OO=0;    rep(i,0,n-1)      if (t[i]) OO++;    cout<<OO<<endl;    rep(i,0,n-1)      if (t[i]) cout<<i<<endl;    return 0;
 

图片P2 MOO LANGUAGE

Farmer John is interested in better interacting with his fellow cows, so he decided he will learn the moo language!

Moo language is actually quite similar to English, but more minimalistic. There are only four types of words: nouns, transitive verbs, intransitive verbs, and conjunctions. Every two consecutive words must be separated by a space. There are also only two types of punctuation: periods and commas. When a period or comma appears after a word, it appears directly after the word, and is then followed by a space if another word appears next.

A sentence needs to follow one of the following formats:

•Type 1: noun + intransitive verb.

•Type 2: noun + transitive verb + noun(s). Specifically, at least one noun must follow the transitive verb, and there must be a comma in front of every following noun besides the first following noun.

Two sentences may be joined into a compound sentence if a conjunction is placed in between them. The resulting compound sentence cannot be further joined with other sentences or other compound sentences. Every sentence (or compound sentence, if two sentences are joined) must end with a period.

Farmer John has a word bank of N words, C commas, and P periods (

1≤ P,C ≤N≤10 ** 3). He may only use a word or punctuation mark as many times as it appears in the word bank. Help him output a sequence of sentences containing the maximum possible number of words.

Each input file contains T (1≤T≤100) independent instances of this problem.

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

The first line contains T, the number of instances. Each instance is specified as follows:

The first line consists of three integers, N, C, and P.

The N following lines will consist of two strings. The first string will be the word itself that FJ can use (a string of at least 1 and at most 10 lowercase letters), and the second string will be either one of the following: noun, transitive-verb, intransitive-verb, or conjunction, denoting the type of the word. It is possible the same word occurs more than once in FJ's word bank, but it will always have the same type each time it appears.

 

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

In the first line, output the maximum possible number of words.

In the second line, output any sequence of sentences with the maximum possible number of words. Any valid sequence will be accepted.

The grader is sensitive to whitespace, so make sure not to output any extraneous spaces, particularly at the end of each line.

SAMPLE INPUT:

3

1 1 1

bessie noun

10 5 4

bessie noun

taught transitive-verb

flew intransitive-verb

elsie noun

farmer noun

john noun

and conjunction

and conjunction

nhoj noun

mooed intransitive-verb

24 5 4

but conjunction

bessie noun

taught transitive-verb

flew intransitive-verb

elsie noun

farmer noun

john noun

and conjunction

and conjunction

nhoj noun

mooed intransitive-verb

bob noun

impressed transitive-verb

cow noun

impressed transitive-verb

leaped intransitive-verb

elsie noun

bella noun

buttercup noun

pushed transitive-verb

mooed intransitive-verb

envy noun

john noun

nhoj noun

SAMPLE OUTPUT:

0

9

nhoj mooed. farmer taught elsie, bessie and john flew.

23

nhoj mooed. nhoj impressed john, farmer, elsie, bessie and cow impressed bob. bella pushed elsie and buttercup flew. envy mooed but john leaped.

For the first test case, the only valid sequence is the empty sequence. For each of the next two test cases, it is possible to construct a sequence of sentences using every word from the word bank except for one.

SCORING:

•Inputs 2-6: N≤10

•Inputs 7-11: N≤100

•Inputs 12-16: N≤1000

•Inputs with remainder 2 when divided by 5: There are no transitive verbs.

•Inputs with remainder 3 when divided by 5: There are no intransitive verbs.

•Inputs with remainder 4 when divided by 5: There are no conjunctions.

 

图片P3 ROTATE AND SHIFT

**Note: The time limit for this problem is 4s, 2x the default.**

To celebrate the start of spring, Farmer John's N cows (1≤N≤2⋅10**5) have invented an intriguing new dance, where they stand in a circle and re-order themselves in a predictable way.

Specifically, there are N positions around the circle, numbered sequentially from 0 to N - 1, with position 0 following position N - 1.  A cow resides at each position. The cows are also numbered sequentially from 0 to N - 1.

Initially, cow i starts in position i. You are told a set of K positions  0 = A1 < A2 < … < Ak < N that are "active", meaning the cows in these positions are the next to move (1 <= K <= N).

In each minute of the dance, two things happen. First, the cows in the active positions rotate: the cow at position A1 moves to position A2, the cow at position A2 moves to position A3, and so on,  with the cow at position Ak moving to position A1. All of All of these K moves happen simultaneously,  so the after the rotation is complete, all of the active positions still contain exactly one cow. Next, the active positions themselves shift: A1 becomes A1 + 1, A2 becomes A2 + 1, and so on(if Ai = N -1 for some active position, then Ai circles back around to 0).

Please calculate the order of the cows after T minutes of the dance (1≤T≤10**9).

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

The first line contains three integers N, K, and T.

The second line contains K  integers representing the initial set of active positions A1,A2,…Ak.  Recall that A1 = 0  and that these are given in increasing order.

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

Output the order of the cows after T minutes, starting with the cow in position 0, separated by spaces.

 

SAMPLE INPUT:

5 3 4

0 2 3

SAMPLE OUTPUT:

1 2 3 4 0

For the example above, here are the cow orders and A for the first four timesteps:

Initial, T = 0: order = [0 1 2 3 4], A = [0 2 3]

T = 1: order = [3 1 0 2 4]

T = 1: A = [1 3 4]

T = 2: order = [3 4 0 1 2]

T = 2: A = [2 4 0]

T = 3: order = [2 4 3 1 0]

T = 3: A = [3 0 1]

T = 4: order = [1 2 3 4 0]

SCORING:

•Inputs 2-7: N≤1000,T≤10000

•Inputs 8-13: No additional constraints.

 

USACO竞赛十年真题题库

对于想要USACO冲刺升级的学生,这套USACO竞赛备考题库资料,非常适合大家。可以根据自己的需求领取!

 

图片
图片
 
 

USACO竞赛十年真题题库

长按扫码,在线领取

👇👇👇

 

关于 USACO 系列赛事的赛题难度。这其实对于已经了解了 USACO竞赛的读者来说,算是一个老生常谈的问题了——从青铜组到黄金组,绝大多数赛题所涉及的知识点,一般不会超过国内 CSP-J 考察知识点范围太多,往届的赛题,可能直到黄金组才涉及到一些国内提高组阶段的图论算法的编码。而本次的赛题,除了白金组和黄金组的第 2 题,涉及到树形动态规划这一算法,其余的 8 道题在知识点层面上,绝未超过 CSP-J 的考察范围。甚至可以说,多知道一些算法,对于解题甚至没有好处:比如白银组的第 3 题,了解过一些图论算法的读者,可能会以为那道题需要 Bellman-Ford 算法寻找图中的负环,但实际上,该题仅需在学而思课程中 Z3 上学期阶段学习到的 BFS 算法即可解决。

所以,要将所有低级组别的赛题拿到满分,只需要学习过几个对应的知识点就够了吗?完全不够。因为这就涉及到了 USACO 系列赛题与国内信息学竞赛,尤其是 CSP-J 的一个很大不同:尤其是对于初学信息学竞赛的入门者而言,USACO 赛题是没有像 CSP-J 第一题那样的送分题的,每一道题都需要参赛者对问题做适当的分析与变形,未必能刚读完题就马上产生非常明确的思路。而在紧张的比赛节奏中,将精力更多放在读题和问题分析,而非编码中,虽然是进阶学习者比较适应的节奏,但初学者往往会对这样的比赛节奏感到焦虑,从而乱了阵脚。其实这样的题,用大家平常经常看到却又略觉抽象的一句话来说,就是“重视考察思维”。实际上,信息学竞赛试题的难点从文本阅读和套路掌握,迁移至更加灵活的“具体问题具体分析”能力的考察,也是国内竞赛的一个趋势。每一套令人拍案叫绝的 USACO 赛题,其实都是在提醒我们的选手自己。

犀牛教育USACO竞赛课程

 

初级班:计算机编程刚入门,语言基础薄弱,无比赛经验计划申请计算机专业的中学生

 

中级班:至少会一门计算机编程语言(推荐C++或Java),算法基础一般,少量比赛经验

 

高级班:有完善的计算机编程语言基础,有入门算法经验,一定比赛经验,如NOIP,USACO银组等

 

犀牛USACO课程

课程

班型

课时

USACO白金级班

3-6人班

40h

USACO金级班

3-6人班

40h

USACO银级班

3-6人班

40h

USACO铜级班

3-6人班

40h

*以上部分班接受插班生
*更多班课信息可添加二维码一对一咨询

 

USACO竞赛冲冲冲!

👊👊👊

图片

 

课程目标:完成USACO的知识点的学习。通过系统地梳理,充分的练习熟悉考试的题型和难点重点,冲刺USACO竞赛高分

 

USACO初级班:计算机编程刚入门,语言基础薄弱,无比赛经验计划申请计算机专业的中学生

 

USACO中级班:至少会一门计算机编程语言(推荐C++或Java),算法基础一般,少量比赛经验

 

USACO高级班:有完善的计算机编程语言基础,有入门算法经验,一定比赛经验,如NOIP,USACO银组等

犀牛USACO竞赛铜升银组
 

USACO竞赛

咨询USACO课程

  长按扫码,在线了解

👇👇👇

16621768052

关键字:USACO竞赛,USACO培训班,USACO竞赛辅导,

推荐资讯
Contact Us