Far Relative’s Problem(贪心)

详细解读文字识别工具———Tesseract-OCR    在尝试破解12306验证码的时候,提前了解了一下应对各种验证码的解决方案,这里主要是学习到了面对文字图片验证码,例如亚马逊、豆瓣等平台的登录时会遇到的情况,效果还不错。 一、工具介绍 ​    Tesseract-OCR 是一款由HP实验室开发由Google维护的开源OCR(Optical Character Recognition... 阅读详情
H - Far Relative’s Problem
Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u
Submit
 
Status
Description
Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating together with him as possible.


Far cars are as weird as Far Far Away citizens, so they can only carry two people of opposite gender, that is exactly one male and one female. However, Far is so far from here that no other transportation may be used to get to the party.


Famil Door should select some day of the year and invite some of his friends, such that they all are available at this moment and the number of male friends invited is equal to the number of female friends invited. Find the maximum number of friends that may present at the party.


Input
The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — then number of Famil Door's friends.


Then follow n lines, that describe the friends. Each line starts with a capital letter 'F' for female friends and with a capital letter 'M' for male friends. Then follow two integers ai and bi (1 ≤ ai ≤ bi ≤ 366), providing that the i-th friend can come to the party from day ai to day bi inclusive.


Output
Print the maximum number of people that may come to Famil Door's party.


Sample Input
Input
4
M 151 307
F 343 352
F 117 145
M 24 128
Output
2
Input
6
M 128 130
F 128 131
F 131 140
F 131 141
M 131 200
M 140 200
Output
4
Hint
In the first sample, friends 3 and 4 can come on any day in range [117, 128].


In the second sample, friends with indices 3, 4, 5 and 6 can come on day 140.




#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define maxn 444
int n,f[maxn],m[maxn];
int max(int a,int b)//不用自定义,c++库函数里有
{
	if(a>b)
	return a;
	else
	return b;
}
int min(int a,int b)
{
	if(a<b)
	return a;
	else
	return b;
}
int main()
{
	int i,j,ans;
    while(~scanf("%d",&n))
    {
        memset(f,0,sizeof(f));
        memset(m,0,sizeof(m));
        while(n--)
        {
            char sex[3];int a,b;

                scanf("%s%d%d",sex,&a,&b);
                for(j=a;j<=b;j++)
                {
                	if(sex[0]=='F')
                	f[j]++;
					else
					m[j]++; 
				}

			ans=0;
       		for(int i=1;i<=366;i++)
       		{
       			ans=max(ans,min(f[i],m[i]));
		    }
		
        }

        	printf("%d\n",2*ans);
    }
    return 0;
}


【全新官方接口】php检测微信域名拦截,检测微信域名被封 你的域名在微信被拦截的3种常见情况 1、域名因违规或有风险被拦截(红色拦截) 2、类似taobao.com,douyin.com这种的恶意竞争式拦截,淘宝、抖音等微信的竞争对手一般都是白色拦截(白色拦截) 3、有一个中间页的拦截,需要多次点击按钮才可以跳转到你的域名的,多是一些新型域名后缀,例如.top .xyz .link后缀,这种情况,备案后可以解决(备案拦截) 通过php get_headers()函数就可以分析到结果 这个下标为6是一个URL,在微信访问后正是这个讨厌的页面! 如果切换为 阅读详情

相关推荐

傅里叶光学(1)

傅里叶光学,可以看作是通信理论中傅里叶变换等一系列数学思想以及系统理论与光学(主要是衍射光学)相结合的产物关于傅里叶光学的应用领域,本节介绍了成像,当然事实上不可能仅限于成像,经典的还如激光散斑的一些应用,干涉计量,还有傅里叶变换光谱学等等。最后总结一下,傅里叶光学我认为可以看做一个工具,对于任意的系统,它能给出一些数学思想与物理原理进行解释和分析,找出系统的扰动和响应的关系,或者说根据扰动和响应,来研究或者设计一个系统。

m0_53607446的博客 1704

CodeForces 629B Far Relative’s Problem(暴力)

思路:一开始看到区间想敲个线段树了,后来发现数据范围好小,直接暴力扫一遍 #include #include #include using namespace std; #define maxn 100000 #define LL long long int cas=1,T; int s[2][400]; int main() { int n; while (scanf("%d",

围巾的ACM博客 654

基于ESP32完成摄像头接入和调试

基于 ESP32 完成摄像头接入和调试是一个常见的物联网(IoT)项目,广泛应用于安防监控、智能家居、图像识别等场景。

xuweilin的博客 5076

Codeforces Round #343 (Div. 2) B. Far Relative’s Problem

B. Far Relative’s Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Famil Door wants to celebrate his

Code_KK的博客 732

Cursor聊天记录迁移工具:实现跨设备AI对话同步与备份

在软件开发中,数据持久化与迁移是常见需求,尤其当工具依赖本地存储时。SQLite作为轻量级关系型数据库,因其嵌入式、零配置特性,常被用于存储应用状态与用户数据。其WAL(预写式日志)模式提升了并发性能,但也增加了数据操作复杂性。通过命令行工具与JSON序列化技术,可以实现结构化数据的提取、转换与安全迁移,这对于保障开发资产的连续性与可移植性具有重要价值。例如,在AI辅助编程场景下,开发者与AI的对话记录包含关键的问题分析、解决方案与决策逻辑,是重要的上下文资产。cursor-chat-transfer工具正

weixin_42551967的博客 539

避坑指南:ANSYS流固耦合计算中System Coupling数据传递设置与常见报错解决

本文深入解析ANSYS Workbench中System Coupling模块在双向流固耦合(FSI)计算中的应用,详细讲解数据传递机制、典型报错解决方案及高阶调试技巧。通过实际案例展示如何优化耦合步长、处理大变形问题,并提升并行计算效率,帮助工程师有效规避常见技术陷阱。

weixin_29213525的博客 739

Far Relative’s Problem(贪心算法)

Far Relative’s Problem 求参加宴会的情侣个数

傲娇的晓明 583

82、yolov11检测模型迁移瑞芯微rk3588和使用昇腾设备300i DUO卡推理 batch=1/3,支持昇腾NMS迁移npu推理

本文介绍了使用昇腾设备进行分割推理的测试流程,包括两种测试方式(cann+onnx和om)。首先验证300iDUO卡的可用性,随后创建Docker镜像和容器以搭建独立环境。通过从指定仓库拉取Ubuntu 20.04镜像,创建容器并映射目录。进入容器后安装必要组件(Python3、GCC等)和系统工具(pciutils、net-tools等),为后续模型转换和迁移做准备。整个流程旨在构建可交付给第三方的标准化测试环境。

sxj731533730 1231

Codeforces--629B--Far Relative’s Problem(模拟)

Far Relative’s Problem Time Limit: 2000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Status Description Famil Door wants to celebra...

weixin_30670925的博客 167

YOLOv12改进策略【模型轻量化】| 替换骨干网络为EfficientNet v1 高效的移动倒置瓶颈结构

本文记录的是基于。采用了创新性的方法,通过精心平衡网络和来提升性能。本文将的设计优势融入YOLOv12中,提升YOLOv12的性能与效率,使其在目标检测任务中表现更为出色。本文配置了原模型中的共种不同大小的模型结构,以满足不同的需求。

Limiiiing的博客 967

【教程4>第6章>第26节】基于FPGA的MMSE信道估计与均衡系统实现与整体测试,并对比LS信道估计

通过前面几个章节的学习,我们完成了MMSE信道估计和均衡系统。为了进一步验证MMSE信道估计的性能,我们在系统的最后,增加一个信道估计误差计算程序。由于MMSE信道估计,其主要优势在SNR较小时提现,因此测试对比时,我们在testbench中,将SNR设置为2db。然后m值,我们不考虑一个固定值,而是一直累加,直到所设置的仿真时间结束。通过对比可以看到,MMSE信道估计性能优于LS信道估计。这样方便FPGA中的误差计算。

FPGA/MATLAB学习教程/源码/项目合作开发 1603

CodeForces 629A Far Relative’s Birthday Cake

思路:水题,每一行每一列统计C的个数,然后每个C的贡献度是n*(n-1)/2即可 #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #de

围巾的ACM博客 610

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

【Codeforces 贪心】Far Relative’s Problem

Far Relative’s ProblemDescription Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of

楚江枫 447

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

Codeforces Far Relative’s Problem(区间贪心)

Far Relative’s Problem Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Famil Door wants to celebrate his birthday with his friends

※夏日星空※ 309

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

Codeforces 629B Far Relative’s Problem 区间贪心

区间贪心

Coding 342

Far Relative’s Problem(贪心模拟)

Far Relative’s Problem Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Famil Door wants to celebrate his birthday with his frien

昨日明眸 383

CodeForces Far Relative’s Problem (贪心)

H - Far Relative’s Problem Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Famil Door wants to celebrate his birthday with his f

Calm微笑 428

CodeForces - 629B Far Relative’s Problem (贪心

B. Far Relative’s Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFamil Door wants to celebrate his birthday with his friends from Far Far A

Yishui_lovely 3543

Far Relative’s Problem (贪心 计算来的最多客人)

Description Famil Door wants to celebrate his birthday with his friends from Far Far Away. He hasnfriends and each of them can come to the party in a specific range of days of the year fromai...

weixin_33828101的博客 156

CodeForces 629B Far Relative’s Problem(贪心)

文章在新的博客站点~欢迎~

AC是绝对不可能的 226

Codeforces 629B(贪心Far Relative’s Problem

Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of cour

王小二的博客 370

Codeforces 629B Far Relative’s Problem(简单区间贪心)

B. Far Relative’s Problem time limit per test  2 seconds memory limit per test  256 megabytes input  standard input output  standard output Famil Door wants to celebrate his

gzdrn的博客 526

Codeforces 629B Far Relative’s Problem(简单区间贪心)

B. Far Relative’s Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Famil Door wants to celebrate his birth

Chunzhen的博客 809

【Codeforces】-629B-.Far Relative’s Problem(贪心.时间区间)

点击打开链接 B. Far Relative’s Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Famil Doo

Bear1998的博客 484

Codeforces Round #343 (Div. 2) B. Far Relative’s Problem (贪心)

H - Far Relative’s Problem Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description Famil Door wants to celebrate his birthday with his f

lu_1110的博客 301

Far Relative’s Problem

 Far Relative’s Problem Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year f...

xiang_hehe的博客 234
上一篇: Rails(栈和队列简单应用)
下一篇: Rightmost Digit(找规律)
Oenheng
博客等级 码龄10年 7粉丝 111原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值