博客
关于我
2020.3.8普及C组 自动匹配(auto)【纪中】【二分】
阅读量:344 次
发布时间:2019-03-04

本文共 595 字,大约阅读时间需要 1 分钟。

一看到此题就觉得是一个二分

但由于 s t r i n g string string不好处理,所以又用了个 m a p map map.
m a p map map是个很实用的东西,我也不太会
所以有不懂的请问

**#include
#include
#include
#include
#include
//头文件要加using namespace std;int w,n,wh,j,k,l,r,mid;string s[30001],fi;map
cha; //定义mapint main(){ freopen("auto.in","r",stdin); freopen("auto.out","w",stdout); cin>>w>>n; for(int i=1; i<=w; i++) { cin>>s[i]; cha[s[i]]=i; } sort(s+1,s+1+w); for(int i=1; i<=n; i++) { cin>>wh>>fi; k=0,l=1,r=w; while(l<=r) //进行二分 { mid=(l+r)/2; if(s[mid]
w||s[l+wh-1].find(fi,0)) //实用的map cout<<-1<

转载地址:http://xjle.baihongyu.com/

你可能感兴趣的文章
mysql数据碎片整理
查看>>
MySQL数据类型
查看>>
MySQL数据类型字节长度
查看>>
mysql数据被误删的恢复方案
查看>>
MySQL数据读写分离(MaxScale)上干货!!!
查看>>
mysql整库导入、导出
查看>>
mysql文本函数和数字函数
查看>>
Mysql新建用户和数据库并授权
查看>>
mysql日志文件
查看>>
mysql日志管理学习笔记
查看>>
MySQL日期时间函数大全
查看>>
mysql时间相减的问题
查看>>
mysql时间表示和计算
查看>>
mysql更新一个表里的字段等于另一个表某字段的值
查看>>
Mysql更新时间列只改日期为指定日期不更改时间
查看>>
MySQL更新锁(for update)摘要
查看>>
mysql替换表的字段里面内容
查看>>
MySQL最大建议行数 2000w,靠谱吗?
查看>>
MySQL有哪些锁
查看>>
MySQL服务器安装(Linux)
查看>>