自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(63)
  • 收藏
  • 关注

原创 UVA 1449 Dominating Patterns(AC自动机):注意输入中有重复单词输入的情况。

地址:https://www.luogu.org/problemnew/show/P3796题目描述有NN个由小写字母组成的模式串以及一个文本串TT。每个模式串可能会在文本串中出现多次。你需要找出哪些模式串在文本串TT中出现的次数最多。输入输出格式输入格式: 输入含多组数据。每组数据的第一行为一个正整数NN,表示共有NN个模式串,1 \leq N \leq 1501...

2018-11-30 00:09:47 252

原创 2018.11.29

差点忘了,写训练日记,得赶紧看了,虽然考试,但是也要坚持下去,考试还是要突击突击的,熬过这一段,重新再看后缀数组了,其实,每一天都有期待这看算法,期待着比赛,每一次都感觉有着极大的兴趣,加油,努力成为一个合格的ACMer(虽然ACM不支持icpc)。比赛等着周六,终于有中文题了。...

2018-11-29 23:36:03 184

原创 AC自动机

学习资料:刘汝佳《算法竞赛入门经典训练指南》博客:https://www.cnblogs.com/cmmdc/p/7337611.html解释:个人理解就是AC自动机在trie跑kmp,进行匹配时候fail失配指针(f数组)就是相当于kmp中next数组,只不过它存的是失配后跳转的位置(fail指针指向的是父节点相同的同值节点(根节点视为与任何节点相同)),而不是跳转之后再向前跳了...

2018-11-28 00:28:23 224

原创 HDU 4707 Pet(DFS:树深度相关) java一个超内存的代码

Pet Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3545    Accepted Submission(s): 1690   Problem Description One day, Lin...

2018-11-26 23:18:07 217

原创 open judge 求序列中的众数 大数类+LinkedHashMap(统计+按value降序排序)

15:求序列中的众数查看 提交 统计 提问总时间限制: 1000ms 内存限制: 65536kB描述输入一个长度为N的整数序列 (不多于128个整数),每个整数的范围在[-1052,1052],计算这个序列的众数。 众数是指出现次数最多的那个数。 如果有多个数出现的次数都达到最多,则取在原序列最先出现的数为众数;如果所有的数都相等,则返回"no"。输入...

2018-11-26 19:09:10 377

原创 2018.11.25 训练博客

    KMP哈哈哈哈,可以独立A题,这个星期看了和刷了不少字典树和KMP的题,感觉理解真的深了好多,不过进度是拉下了,还得多抽时间看,不过这样心里学的踏实。   下周看AC自动机和后缀数组,顺便复习复习BFS和DFS。   最近,打了不少比赛,atcoder最近没啥比赛,牛客网的比赛冲突,cf的比赛倒坚持下去了,天天一两点,但感觉还不错,虽然自己很菜,但是竟然有点喜欢打比赛了。  向...

2018-11-25 23:11:56 157

原创 Codeforces Beta Round #93 (Div. 1 Only)B. Password (KMP:>=3的相同前缀后缀 两种做法)

B. Passwordtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAsterix, Obelix and their temporary buddies Suffix and Prefix has fin...

2018-11-25 17:46:40 281

原创 poj 2752 Seek the Name, Seek the Fame (KMP前后缀相同)

Seek the Name, Seek the FameTime Limit: 2000MS   Memory Limit: 65536K Total Submissions: 24954   Accepted: 13001 DescriptionThe little cat is so famous, that many couples tramp ove...

2018-11-25 16:28:19 220

原创 HDU 2594 Simpsons’ Hidden Talents (字符串-KMP 前缀与后缀)

Simpsons’ Hidden Talents Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15010    Accepted Submission(s): 5148   Problem Descri...

2018-11-25 15:11:37 344

原创 HDU 3746 Cyclic Nacklace (KMP:补齐循环节)

Cyclic Nacklace Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16284    Accepted Submission(s): 6747   Problem Description ...

2018-11-25 14:16:34 270

原创 POJ 2406 Power Strings(KMP:找串循环节)

Power StringsTime Limit: 3000MS   Memory Limit: 65536K Total Submissions: 60362   Accepted: 24990 DescriptionGiven two strings a and b we define a*b to be their concatenation. For ...

2018-11-25 00:59:37 205

原创 poj 1961 Period (KMP+最小循环节)

PeriodTime Limit: 3000MS   Memory Limit: 30000K Total Submissions: 20563   Accepted: 10022 DescriptionFor each prefix of a given string S with N characters (each character has an A...

2018-11-25 00:49:20 254

原创 Codeforces Round #524 (Div. 2) A. Petya and Origami

A. Petya and Origamitime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya is having a party soon, and he has decided to invite hi...

2018-11-24 23:05:18 344

原创 Codeforces Round #524 (Div. 2) B. Margarite and the best present 规律题

B. Margarite and the best presenttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle girl Margarita is a big fan of competitiv...

2018-11-24 23:04:13 262

原创 Codeforces Round #524 (Div. 2) C. Masha and two friends

C. Masha and two friendstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently, Masha was presented with a chessboard with a he...

2018-11-24 23:02:55 317

原创 java 实现集合的交差并补

package Work1;import java.util.ArrayList;import java.util.HashSet;import java.util.List;import java.util.Set;public class Work1 { public static void main(String[] args) { List &l...

2018-11-24 21:20:11 1440

原创 AtCoder Beginner Contest 113 C - ID

C - IDTime limit : 2sec / Memory limit : 1024MBScore: 300 pointsProblem StatementIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.Cit...

2018-11-24 14:01:34 381

原创 printf函数小技巧

printf格式输出规则:%[flags] [width] [.precision] [{h | l | I64 | L}]type这个是格式化字符串的模式。其中flags是指正负号和前导0或空格width是输出宽度precision是精度{h | l | I64 | L}是可选的类型前辍type是输出类型标识如 d, i, o, x, c, s等例子:对于int a;左侧...

2018-11-24 01:09:46 277

原创 Codeforces Round #523 (Div. 2)B. Views Matter 好题

B. Views Mattertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou came to the exhibition and one exhibit has drawn your attenti...

2018-11-24 00:51:17 302

原创 Codeforces Round #523 (Div. 2)A. Coins 水题

A. Coinstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have unlimited number of coins with values 1,2,…,n1,2,…,n. You want ...

2018-11-23 23:55:41 171

原创 2018.11.22 训练总结

    我还是想做题,我还是习惯那种,看一个知识点,然后刷很多题的那种,虽然速度有点慢,但心里踏实,也有利于后面的知识点理解。找到属于自己的学习方法。  div2开始了,打比赛了。以后每场都打,一心一意搞ACM。...

2018-11-22 23:30:13 139

原创 HDU 3336 Count the string KMP:串前缀匹配自身+DP

Count the stringTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14842    Accepted Submission(s): 6771 Problem DescriptionIt is well know...

2018-11-22 23:25:00 272

原创 POJ 3764 The xor-longest Path dfs+字典树求最大异或

The xor-longest Path Time Limit:2000MS Memory Limit:65536K Total Submissions:10231 Accepted:2077 Description In an edge-weighted tree, the xor-len...

2018-11-22 00:27:36 331

原创 CodeForces - 1079B Personalized Cup 好题

B. Personalized Cuptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAt many competitions that have a word «cup» in its official na...

2018-11-21 23:38:52 325

原创 CodeForces - 1079A A. Kitchen Utensils 水题

A. Kitchen Utensilstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe king's birthday dinner was attended by kk guests. The dinn...

2018-11-21 23:24:40 588

原创 Find MaxXorSum 经典字典树求异或最大值(数据量大)

题目:https://cn.vjudge.net/problem/NBUT-1597 [1597] Find MaxXorSum 时间限制: 2000 ms 内存限制: 65535 K 问题描述 Given n non-negative integers, you need to find two integers a and b that a xor b is max...

2018-11-21 17:23:39 264

原创 CH 1602 The XOR Largest Pair 字典树+异或

题目地址:http://contest-hunter.org:83/contest/0x10%E3%80%8C%E5%9F%BA%E6%9C%AC%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E3%80%8D%E4%BE%8B%E9%A2%98/1602%20The%20XOR%20Largest%20Pair描述在给定的N个整数A1,A2……AN中选出两个进行...

2018-11-21 16:38:01 406

原创 HDU 1247 Hat’s Words(字典树Trie):单词匹配

  Hat’s Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19393    Accepted Submission(s): 6829   Problem Description ...

2018-11-21 01:14:08 349

原创 HDU 1671 Phone List 字典树 多种做法:问你字典中是否有一个字符串是其他字符串的前缀?

Phone ListTime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 26141    Accepted Submission(s): 8724 Problem DescriptionGiven a list of phone...

2018-11-20 23:50:21 201

原创 字符串——KMP

【定义】Knuth-Morris-Pratt 字符串查找算法,简称为 “KMP算法”,常用于在一个文本串S内查找一个模式串P 的出现位置。 KMP算法的核心在于求next数组。next数组的含义为:代表当前字符之前的字符串中,有多大长度的相同前缀后缀。例如如果 next [j] = k,代表j 之前的字符串中有最大长度为k的相同前缀后缀。(注意是抛弃当前的字符,往前看的字符串...

2018-11-19 22:15:01 501

原创 HDU 1711Number Sequence KMP模板题(找模板第一次出现的位置)

Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 42763    Accepted Submission(s): 17662   Problem Description...

2018-11-19 22:13:30 182

原创 POJ 3461Oulipo  KMP模板题 (统计一个串出现的次数)

OulipoTime Limit: 1000MS   Memory Limit: 65536K Total Submissions: 50428   Accepted: 20006 DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition,...

2018-11-19 22:02:42 230

原创 2018.11.19

本周打了两场CF比赛,发现自己很菜了,多打点,享受比赛的过程。知识点学习的时候,不做题还是不舒服,准备做一些基础的,巩固一下概念。 进行到字符串KMP了,进度有点慢,得抓紧一下。...

2018-11-19 00:06:47 107

原创 HDU 1251 统计难题 字典树

统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 59226    Accepted Submission(s): 20650   Problem Description Ignatius...

2018-11-18 20:33:10 217

原创 字典树 trie

具体原理:刘汝佳《算法竞赛入门经典训练指南》P208作用:字典树又叫单词查找树(Trie)或前缀树,是一个实现字符串。你可以在O(m)(m为所给单词的长度)时间内判断出该单词是否属于字典。代码模板: #include<cstdio>#include<iostream>#include<fstream>#include<algori...

2018-11-18 17:28:18 286

原创 Uva1401 Remember the Word 字典树trie

题意翻译Uva1401 Remember the Word (记单词) 翻译题目描述 Neal 对有关组合的问题很感兴趣,现在他有一个关于单词的有趣问题要解决: 他知道大佬Ray的记忆力像存储器一样好,这样的问题肯定难不倒他,于是Neal把问题给了蒟蒻Jiejie。Jiejie经常记不住数字,他就用火柴棒来帮助自己记忆。Jiejie最多只能用20071027根火柴棒(因为他...

2018-11-18 17:17:59 251

原创 字符串与字符数组转化

转自:https://blog.csdn.net/xinwang24/article/details/66126861:字符数组换为字符串见代码#include &lt;iostream&gt;#include &lt;string&gt;using namespace std; int main(){    char a[10]="aaaabbbba";    stri...

2018-11-18 16:38:48 351

原创 线段树应用:扫描线

扫描线暴力解决的话时间和空间复杂度往往是不够的。所以,扫描线也就成了线段树很大的应用。具体原理解释(写得很好):https://blog.csdn.net/u013480600/article/details/22548393https://blog.csdn.net/zearot/article/details/48299459#t19https://www.cnblogs....

2018-11-18 00:05:05 300

原创 HDU 1542 Atlantis(线段树:扫描线)

Atlantis Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19655    Accepted Submission(s): 7893   Problem Description There ...

2018-11-18 00:01:02 213

原创 Codeforces Round #521 (Div. 3)A. Frog Jumping

A. Frog Jumpingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA frog is currently at the point 00 on a coordinate axis OxOx. It ...

2018-11-17 20:05:07 327

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除