博客
关于我
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截取sql语句
查看>>
mysql截取身份证号前几位_EXCEL中怎样截取身份证号前六位数字
查看>>
mysql手工注入
查看>>
MySQL执行SQL文件出现【Unknown collation ‘utf8mb4_0900_ai_ci‘】的解决方案
查看>>
Mysql执行update by id的过程
查看>>
mysql执行计划
查看>>
MySQL执行计划 EXPLAIN参数
查看>>
MySQL执行计划【explain】,看这一篇就够啦!
查看>>
Mysql执行计划字段解释
查看>>
mysql执行计划怎么看
查看>>
MySQL执行计划解读
查看>>
mysql执行顺序与索引算法
查看>>
mysql批量update优化_Mysql中,21个写SQL的好习惯,你值得拥有呀
查看>>
mysql批量update操作时出现锁表
查看>>
MYSQL批量UPDATE的两种方式
查看>>
mysql批量修改字段名(列名)
查看>>
MySQL批量插入数据遇到错误1213的解决方法
查看>>
mysql技能梳理
查看>>
MySQL报Got an error reading communication packets错
查看>>
Mysql报错Can‘t create/write to file ‘/tmp/#sql_3a8_0.MYD‘ (Errcode: 28 - No space left on device)
查看>>