Live2d Test Env

随笔分类 -  hash&离散化

摘要:#include<bits/stdc++.h> using namespace std; const int maxn=100010; int num[26],used[26]; char c[maxn],ans[maxn]; int main() { int L,i; scanf("%s",c+1 阅读全文
posted @ 2018-06-11 09:26 nimphy 阅读(258) 评论(0) 推荐(0) 编辑
摘要:You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the number of segments it contains. Input 阅读全文
posted @ 2018-03-15 21:09 nimphy 阅读(396) 评论(2) 推荐(0) 编辑
摘要:题意: 给出一个矩阵,初始每个位置上的值都为0,然后有两种操作 一种是更改某个位置上的值 另一种是求某个位置附近曼哈顿距离不大于K的所有位置的值的总和 技巧: 坐标旋转,使得操作之后菱形变成方方正正的矩形,(即“曼哈顿距离”转化为“切比雪夫距离”)方便使用树状数组进行计算。 利用哈希进行离散,节约空 阅读全文
posted @ 2017-12-04 13:57 nimphy 阅读(357) 评论(0) 推荐(0) 编辑
摘要:之前总结了一下我觉得有用的erase,lower_bound,upper_bound。 现在总结一下unique,unique的作用是“去掉”容器中相邻元素的重复元素(不一定要求数组有序),它会把重复的元素添加到容器末尾(所以数组大小并没有改变),而返回值是去重之后的尾地址,下面举个例子。 由于返回 阅读全文
posted @ 2017-12-01 18:33 nimphy 阅读(27000) 评论(0) 推荐(1) 编辑
摘要:Give you a sequence and ask you the kth big number of a inteval. InputThe first line is the number of the test cases. For each test case, the first li 阅读全文
posted @ 2017-11-30 21:02 nimphy 阅读(350) 评论(0) 推荐(0) 编辑
摘要:注意一:卡map的时间,但是好好写+运气还是可以卡过,哇。。。求人品爆发 注意二:去前导0,毕竟‘0’也有ASCII码 阅读全文
posted @ 2017-10-23 20:39 nimphy 阅读(175) 评论(0) 推荐(0) 编辑
摘要:所谓马拉车,和老汉推车毫无关系!!! manacher用于处理对称问题,主要是针对回文串,如:tattarrattat(牛津英语词典中最长的回文单词) HDU3068 ,用char,而不要用string,不然会超s。View Code HDU3294 View Code HDU4513 View C 阅读全文
posted @ 2017-10-23 13:19 nimphy 阅读(264) 评论(0) 推荐(0) 编辑
摘要:给定一个字符串S,请统计S的所有子串中,有多少个本质不同的回文字符串? 注意如果两个位置不同的子串满足长度相同且对应字符也都相同,则认为这两个子串本质上是相同的。 Input 一个只包含小写字母的字符串S。 对于30%的数据,S长度不超过100。 对于60%的数据,S长度不超过1000。 对于100 阅读全文
posted @ 2017-10-23 09:08 nimphy 阅读(2757) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示