热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

USACO2018openBronze试题

这里是USACO2018全美公开赛铜组的试题,题解USACO上有,鄙人不才。USACO2018USOpenContest,BronzeThebronze

这里是USACO2018全美公开赛铜组的试题,题解USACO上有,鄙人不才。


USACO 2018 US Open Contest, Bronze

The bronze division had 812 total participants, of whom 657 were pre-college students. All competitors who scored 700 or higher on this contest are automatically promoted to the silver division. Detailed results for all those promoted are here.


1

Team Tic Tac Toe
View problem  |   Test data   |   Solution


2

Milking Order
View problem  |   Test data   |   Solution


3

Family Tree
View problem  |   Test data   |   Solution
题解USACO上有详细的,在Solution里



USACO 2018 US Open Contest, Bronze

Problem 1. Team Tic Tac Toe



Return to Problem List
Contest has ended.



Analysis mode





English (en)Armenian (hy)French (fr)Russian (ru)Spanish (es)Chinese (zh)

Farmer John owns 26 cows, which by happenstance all have names starting with different letters of the alphabet, so Farmer John typically refers to each cow using her first initial -- a character in the range AZ A…Z.

The cows have recently become fascinated by the game of tic-tac-toe, but since they don't like the fact that only two cows can play at a time, they have invented a variant where multiple cows can play at once! Just like with regular tic-tac-toe, the game is played on a 3×3 3×3 board, only instead of just Xs and Os, each square is marked with a single character in the range AZ A…Z to indicate the initial of the cow who claims that square.

An example of a gameboard might be:

COW
XXO
ABC

The cows fill in each of the nine squares before they become confused about how to figure out who has won the game. Clearly, just like with regular tic-tac-toe, if any single cow has claimed an entire row, column, or diagonal, that cow could claim victory by herself. However, since the cows think this might not be likely given the larger number of players, they decide to allow cows to form teams of two, where a team of two cows can claim victory if any row, column, or diagonal consists only of characters belonging to the two cows on the team, and moreover if characters from both cows (not just one) are used in this row, column, or diagonal.

Please help the cows figure out how many individuals or two-cow teams can claim victory. Note that the same square on the game board might possibly be usable in several different claims to victory.

INPUT FORMAT (file tttt.in):

The input consists of three lines, each of which is three characters in the range AZ A…Z.

OUTPUT FORMAT (file tttt.out):

Output should consist of two lines. On the first line, output the number of individual cows who can claim victory. On the second line, output the number of two-cow teams that could claim victory.

SAMPLE INPUT:

COW
XXO
ABC

SAMPLE OUTPUT:

0
2

In this example, no single cow can claim victory. However, if cows C and X team up, they can win via the C-X-C diagonal. Also, if cows X and O team up, they can win via the middle row.

Problem credits: Brian Dean 



USACO 2018 US Open Contest, Bronze

Problem 2. Milking Order

Return to Problem List
Contest has ended.

Analysis mode


English (en)Armenian (hy)French (fr)Russian (ru)Spanish (es)Chinese (zh)
Farmer John's N N cows (2N100 2≤N≤100), conveniently numbered 1N 1…N as always, happen to have too much time on their hooves. As a result, they have worked out a complex social structure related to the order in which Farmer John milks them every morning. After weeks of study, Farmer John has discovered that this structure is based on two key properties.

First, due to the cows' social hierarchy, some cows insist on being milked before other cows, based on the social status level of each cow. For example, if cow 3 has the highest status, cow 2 has average status, and cow 5 has low status, then cow 3 would need to be milked earliest, followed later by cow 2 and finally by cow 5.

Second, some cows only allow themselves to be milked at a certain position within the ordering. For example, cow 4 might insist on being milked second among all the cows.

Luckily, Farmer John will always be able to milk his cows in an order satisfying all of these conditions.

Unfortunately, cow 1 has recently fallen ill, so Farmer John wants to milk this cow as early in the order as possible so that she can return to the barn and get some much-needed rest. Please help Farmer John determine the earliest position cow 1 can appear in the milking order.

INPUT FORMAT (file milkorder.in):

The first line contains N N, M M (1M<N 1≤M), and K K (1K<N 1≤K), indicating that Farmer John has N N cows, M M of his cows have arranged themselves into a social hierarchy, and K K of his cows demand that they be milked in a specific position in the order. The next line contains M M distinct integers m i  mi (1m i N 1≤mi≤N). The cows present on this line must be milked in the same order in which they appear in this line. The next K K lines contain two integers c i  ci (1c i N 1≤ci≤N) and p i  pi (1p i N 1≤pi≤N), indicating that cow c i  ci must be milked in position p i  pi.

It is guaranteed that under these constraints, Farmer John will be able to construct a valid milking order.

OUTPUT FORMAT (file milkorder.out):

Please output the earliest position cow 1 can take in the milking order.

SAMPLE INPUT:

6 3 2
4 5 6
5 3
3 1

SAMPLE OUTPUT:

4

In this example, Farmer John has six cows, with cow 1 being sick. He needs to milk cow 4 before cow 5 and cow 5 before cow 6. Moreover, Farmer John has to milk cow 3 first and cow 5 third.

FJ has to milk cow 3 first, and since cow 4 has to come before cow 5, cow 4 must be milked second, and cow 5 third. Thus, cow 1 can be fourth at earliest in the order.

Problem credits: Jay Leeds 



USACO 2018 US Open Contest, Bronze

Problem 3. Family Tree

Return to Problem List
Contest has ended.

Analysis mode


English (en)Armenian (hy)French (fr)Russian (ru)Spanish (es)Chinese (zh)
Farmer John owns a family-run farm that has been passed down over several generations, with a herd of cows whose familial roots can similarly be traced back several generations on the same farm. By examining old records, Farmer John is curious how the cows in his current herd are related to each-other. Please help him in this endeavor!

INPUT FORMAT (file family.in):

The first line of input contains N N (1N100 1≤N≤100) followed by the names of two cows. Cow names are each strings of at most 10 uppercase letters (AZ A…Z). Farmer John is curious about the relationship between the two cows on this line of input.

The next N N lines each contain two cow names X X and Y Y, indicating that X X is the mother of Y Y.

OUTPUT FORMAT (file family.out):

You should print one line of output indicating the relationship between the two cows specified on the first line of input (for simplicity, let&#39;s call these two cows BESSIE and ELSIE for the examples below). Here are the different types of relationships that are possible:
  • You should output "SIBLINGS" if BESSIE and ELSIE have the same mother.
  • BESSIE might be a direct descendant of ELSIE, meaning that ELSIE is either the mother, grand-mother, great-grand-mother, great-great-grand-mother, etc., of BESSIE. If this is the case, you should print "ELSIE is the (relation) of BESSIE", where (relation) is the appropriate relationship, for example "great-great-grand-mother".
  • If ELSIE is a child of an ancestor of BESSIE (and ELSIE is not herself an ancestor or sister of BESSIE), then ELSIE is BESSIE&#39;s aunt. You should output "ELSIE is the aunt of BESSIE" if ELSIE is a child of BESSIE&#39;s grand-mother, "ELSIE is the great-aunt of BESSIE" if ELSIE is a child of BESSIE&#39;s great-grand-mother, "ELSIE is the great-great-aunt of BESSIE" if ELSIE is a child of BESSIE&#39;s great-great-grand-mother, and so on.
  • If BESSIE and ELSIE are related by any other means (i.e., if they share a common ancestor), they are cousins, and you should simply output "COUSINS".
  • You should output "NOT RELATED" if BESSIE and ELSIE have no common ancestor, or neither is directly descended from the other.

The following diagram helps illustrate the relationships above, which are the only relationship types you need to consider. Observe that some relationships like "niece" (daughter of sister) are not necessary since if BESSIE is the niece of ELSIE, then ELSIE is BESSIE&#39;s aunt.

SAMPLE INPUT:

7 AA BB
MOTHER AA
GGMOTHER BB
MOTHER SISTER
GMOTHER MOTHER
GMOTHER AUNT
AUNT COUSIN
GGMOTHER GMOTHER

SAMPLE OUTPUT:

BB is the great-aunt of AA

Problem credits: Brian Dean 





推荐阅读
  • 本文详细介绍了如何处理Oracle数据库中的ORA-00227错误,即控制文件中检测到损坏块的问题,并提供了具体的解决方案。 ... [详细]
  • 深入解析mt_allocator内存分配器(二):多线程与单线程场景下的实现
    本文详细介绍了mt_allocator内存分配器在多线程和单线程环境下的实现机制。该分配器以2的幂次方字节为单位分配内存,支持灵活的配置和高效的性能。文章分为内存池特性描述、内存池实现、单线程内存池实现、内存池策略类实现及多线程内存池实现等部分,深入探讨了内存池的初始化、内存分配与回收的具体实现。 ... [详细]
  • iOS 小组件开发指南
    本文详细介绍了iOS小部件(Widget)的开发流程,从环境搭建、证书配置到业务逻辑实现,提供了一系列实用的技术指导与代码示例。 ... [详细]
  • Exploring issues and solutions when defining multiple Faust agents programmatically. ... [详细]
  • A1166 峰会区域安排问题(25分)PAT甲级 C++满分解析【图论】
    峰会是指国家元首或政府首脑之间的会议。合理安排峰会的休息区是一项复杂的工作,理想的情况是邀请的每位领导人都是彼此的直接朋友。 ... [详细]
  • 2022年4月15日的算法练习题,包括最长公共子序列和线段树的应用。 ... [详细]
  • 本文详细介绍了Oracle RMAN中的增量备份机制,重点解析了差异增量和累积增量备份的概念及其在不同Oracle版本中的实现。通过对比两种备份方式的特点,帮助读者选择合适的备份策略。 ... [详细]
  • 本文详细介绍了如何在本地环境中安装配置Frida及其服务器组件,以及如何通过Frida进行基本的应用程序动态分析,包括获取应用版本和加载的类信息。 ... [详细]
  • 本文介绍了进程的基本概念及其在操作系统中的重要性,探讨了进程与程序的区别,以及如何通过多进程实现并发和并行。文章还详细讲解了Python中的multiprocessing模块,包括Process类的使用方法、进程间的同步与异步调用、阻塞与非阻塞操作,并通过实例演示了进程池的应用。 ... [详细]
  • Java实现实时更新的日期与时间显示
    本文介绍了如何使用Java编程语言来创建一个能够实时更新显示系统当前日期和时间的小程序。通过使用Swing库中的组件和定时器功能,可以实现界面友好且功能强大的时间显示应用。 ... [详细]
  • 基于51单片机的多项目设计实现与优化
    本文探讨了基于51单片机的多个项目的设计与实现,包括PID控制算法的开关电源设计、八音电子琴仿真设计、智能抽奖系统控制设计及停车场车位管理系统设计。每个项目均采用先进的控制技术和算法,旨在提升系统的效率、稳定性和用户体验。 ... [详细]
  • 本文将作为我硕士论文的一部分,但鉴于其内容的独特性和趣味性,决定单独发布。文中将定义一些皮亚诺公理,并介绍如何使用这些公理进行等式替换,以证明定理。 ... [详细]
  • 本文介绍了如何通过创建自定义 XML 文件来修改 Android 中 Spinner 的项样式,包括颜色和大小的调整。 ... [详细]
  • 深入解析Java并发之ArrayBlockingQueue
    本文详细探讨了ArrayBlockingQueue,这是一种基于数组实现的阻塞队列。ArrayBlockingQueue在初始化时需要指定容量,因此它是一个有界的阻塞队列。文章不仅介绍了其基本概念和数据结构,还深入分析了其源码实现,包括各种入队、出队、获取元素和删除元素的方法。 ... [详细]
  • 本文将详细介绍如何配置并整合MVP架构、Retrofit网络请求库、Dagger2依赖注入框架以及RxAndroid响应式编程库,构建高效、模块化的Android应用。 ... [详细]
author-avatar
手机用户2502935255
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有