上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 40 下一页

2013年4月20日

Reverse a Road 最短路

摘要: Reverse a RoadTime Limit 1000msMemory Limit 65536Kdescription Peter resides in the city of Nanuh, and goes to his working place in this city every weekday.He has been totally annoyed with the road traffic of this city. All the roads in this city are one-way, so he has to drive a longer way than he . 阅读全文

posted @ 2013-04-20 17:44 电子幼体 阅读(178) 评论(0) 推荐(0) 编辑

2013年4月19日

KMP算法模板

摘要: #include <iostream> #include <cstring> #include <cstdio> using namespace std; int f[1111111]; void getfail(char* P,int *f) { int m=strlen(P); f[0]=f[1]=0; for (int i=1;i<m;i++) { int j=f[i]; while (j&&P[i]!=P[j]) j=f[j]; f[i+1]=(P[i]==P[j])?j+1:0; } } ... 阅读全文

posted @ 2013-04-19 21:42 电子幼体 阅读(98) 评论(0) 推荐(0) 编辑

LA 3026 - Period KMP失配函数的应用

摘要: For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 ≤ i ≤ N) we want to know the largest K > 1 (if there is one) such that the prefix of S with lengt 阅读全文

posted @ 2013-04-19 21:41 电子幼体 阅读(180) 评论(0) 推荐(0) 编辑

LA 3942 - Remember the Word 字典树 dp

摘要: Neal is very curious about combinatorial problems, and now here comes a problem about words. Knowing that Ray has a photographic memory and this may not trouble him, Neal gives it to Jiejie.Since Jiejie can't remember numbers clearly, he just uses sticks to help himself. Allowing for Jiejie' 阅读全文

posted @ 2013-04-19 19:49 电子幼体 阅读(213) 评论(0) 推荐(0) 编辑

hdu 1394 Minimum Inversion Number 线段树 逆序数

摘要: Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6365Accepted Submission(s): 3875Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai 阅读全文

posted @ 2013-04-19 18:19 电子幼体 阅读(154) 评论(0) 推荐(0) 编辑

Codeforecs 69E. Subsegments STL/线段树

摘要: E. Subsegmentstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputProgrammer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in, which Sasha coped with. 阅读全文

posted @ 2013-04-19 17:40 电子幼体 阅读(295) 评论(0) 推荐(0) 编辑

Codeforces 69D. Dot 博弈 dp

摘要: D. Dottime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a 阅读全文

posted @ 2013-04-19 17:37 电子幼体 阅读(286) 评论(0) 推荐(0) 编辑

2013年4月18日

线段树 poj 3468 A Simple Problem with Integers 区间add更新

摘要: A Simple Problem with IntegersTime Limit:5000MSMemory Limit:131072KTotal Submissions:41899Accepted:12169Case Time Limit:2000MSDescriptionYou haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interv 阅读全文

posted @ 2013-04-18 16:42 电子幼体 阅读(157) 评论(0) 推荐(0) 编辑

线段树 1698 Just a Hook 区间set更新

摘要: Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11297Accepted Submission(s): 5591Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecu 阅读全文

posted @ 2013-04-18 16:41 电子幼体 阅读(117) 评论(0) 推荐(0) 编辑

线段树 hdu 1754 I Hate It 单点更新 区间求最值

摘要: I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 23163Accepted Submission(s): 9257Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个 阅读全文

posted @ 2013-04-18 16:40 电子幼体 阅读(157) 评论(0) 推荐(0) 编辑

上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 40 下一页

导航