Codeforces Round #253 (Div. 1) A Borya and Hanabi
2 seconds
256 megabytes
standard input
standard output
Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game.
Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding
n cards. The game is somewhat complicated by the fact that everybody sees Borya's cards except for Borya himself. Borya knows which cards he has but he knows nothing about the order they lie in. Note that Borya can have
multiple identical cards (and for each of the 25 types of cards he knows exactly how many cards of this type he has).
The aim of the other players is to achieve the state when Borya knows the color and number value of each of his cards. For that, other players can give him hints. The hints can be of two types: color hints and value hints.
A color hint goes like that: a player names some color and points at all the cards of this color.
Similarly goes the value hint. A player names some value and points at all the cards that contain the value.
Determine what minimum number of hints the other players should make for Borya to be certain about each card's color and value.
The first line contains integer n (1 ≤ n ≤ 100) — the number of Borya's cards. The next line contains the descriptions of
n cards. The description of each card consists of exactly two characters. The first character shows the color (overall this position can contain five distinct letters — R, G, B, Y, W). The second character shows the card's
value (a digit from 1 to 5). Borya doesn't know exact order of the cards they lie in.
Print a single integer — the minimum number of hints that the other players should make.
2
G3 G3
0
4
G4 R4 R3 B3
2
5
B1 Y1 W1 G1 R1
4
In the first sample Borya already knows for each card that it is a green three.
In the second sample we can show all fours and all red cards.
In the third sample you need to make hints about any four colors.
Codeforces Round #253 (Div. 1) A Borya and Hanabi的更多相关文章
- Codeforces Round #253 (Div. 1) A. Borya and Hanabi 暴力
A. Borya and Hanabi Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/442/p ...
- Codeforces Round 253 (Div. 2)
layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- Codeforces Round #253 (Div. 1) (A, B, C)
Codeforces Round #253 (Div. 1) 题目链接 A:给定一些牌,然后如今要提示一些牌的信息,要求提示最少,使得全部牌能够被分辨出来. 思路:一共2^10种情况,直接暴力枚举,然 ...
- Codeforces Round #253 (Div. 2)——Borya and Hanabi
题目连接 题意: n表示有n个卡片.每一个卡片有一种颜色和一个数字(共五种不同的颜色和五个不同的数字). 事先知道每种卡片有几张.可是不知道详细的位置. 问须要几次提示就能够知道全部卡片的位置都在哪里 ...
- Codeforces Round #253 (Div. 2) D. Andrey and Problem
关于证明可以参考题解http://codeforces.com/blog/entry/12739 就是将概率从大到小排序然后,然后从大到小计算概率 #include <iostream> ...
- Codeforces Round #253 (Div. 2) D题
题目大意是选出一个其他不选,问问最大概率: 刚开始想到DP:F[I][J][0]:表示从 前I个中选出J个的最大值, 然后对于F[I][J][1]=MAX(F[I-1][J][1],F[I-1][J- ...
- Codeforces Round #253 (Div. 2) B - Kolya and Tandem Repeat
本题要考虑字符串本身就存在tandem, 如测试用例 aaaaaaaaabbb 3 输出结果应该是8而不是6,因为字符串本身的tanderm时最长的 故要考虑字符串本身的最大的tanderm和添加k个 ...
- Codeforces Round #253 (Div. 2) A. Anton and Letters
题目很简单,只需要注意带空格的输入用getline即可 #include <iostream> #include <vector> #include <algorithm ...
- Codeforces Round #253 (Div. 2), problem: (B)【字符串匹配】
简易字符串匹配,题意不难 #include <stdio.h> #include <string.h> #include <math.h> #include < ...
随机推荐
- win10x64下的redis安装与使用
先引用百度百科的一段话吧,具体可以到百科查看吧. Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.从2010年 ...
- net core 使用ef生成实体类(SqlServer)
1)打开程序包管理器控制台 2)输入命令 Install-Package Microsoft.EntityFrameworkCore.SqlServer 3)输入命令 Install-Packag ...
- c/s端测试——nw.js篇(selenium工具)
最近在为兄弟部门开发自动化测试工具. 然后才知道现在竟然有JS工具可以把JS打包成cs端程序了,太牛了,js发展是真快.并且还是跨平台的,mac.windows.linux都支持. 当然,今天不是说n ...
- Intel CPU参数查询网站
链接:https://ark.intel.com/#@Processors
- ssh和sshd服务
1.1 对称加密和非对称加密 对称加密:加密和解密使用一样的算法,只要解密时提供与加密时一致的密码就可以完成解密.例如QQ登录密码,银行卡密码,只要保证密码正确就可以. 非对称加密:通过公钥(publ ...
- NFS和DHCP服务
1. NFS NFS,Network File System的简写,即网络文件系统.网络文件系统是FreeBSD支持的文件系统中的一种,也被称为NFS: NFS允许一个系统在网络上与他人共享目录和文件 ...
- js中表格的相关操作
tHead:表头 tBodies:表格正文 tFoot:表格尾 rows:行 cells:列 表格的应用: 1.获取 2.表格创建 3.隔行变色 4.删除一行 <!DOCTYPE html> ...
- python基础知识11-文件操作
文件 装饰器,装饰函数或者类的方法. 1.文件的基本操作 打开文件: 注意绝对路径与相对路径. path = 'text.txt' path = r'/home/pyvip/py_case/text. ...
- 关于最新版本react-native0.59.x构建的问题解决方案
react-native的版本更新是真的快,几乎几天就是一个小版本,然而在这个过程中,对于新手来说,成功构建一个,并跑起来的项目,还是有一定难度的,各种问题,一不小心,你就会发现你的时间全部都浪费在了 ...
- 调试jz2440生成特定后缀的命令
生成dis命令: arm-linux-objdump -D u-boot> u-boot.dis 版权声明:本文为博主原创文章,未经博主允许不得转载.