- 博客(11)
- 收藏
- 关注
原创 Hdu 5945 bfs+并查集
题意:给x,k,t,求x最快衰减到1的速度。其中x可以减去1-t之间的一个数,k|x时可以除以k。做法:直接搜或者dp都会跪。问题在于已经更新的段被重复访问次数太多。为了避免这个问题,我们从1开始bfs,并且记录每个点所在被更新线段的左端点为他的father,这样bfs更新线段的时候,只需要从father处向左更新,并且做一下类似并查集的维护操作即可,这样每个点只会被遍历一次。代码:#include
2016-10-30 20:30:17 480
原创 Hdu 4821 hash+map判重
题意:给定一个字符串,找这样的子串数,长为l*m,能分解成m个长为l的不同子串。 做法:算出所有长为l的hash值,分成l组,跑一遍,用map做一下判重。 代码:#include <cstdio> #include <algorithm> #include <cstring> #include <map> #include <iostream> using namespace std;typed
2016-10-27 18:48:11 363
原创 Poj 2774 二分+字符串hash
题意:给两个长1e5的字符串,求最长公共子串长度 做法:二分答案+hash。hash的思路大概是把字符串看做是p进制数,为了尽可能避免冲突,p取素数31或131等。hash完了排序,通过判断hash值相同来判字符串相同。 代码:#include <cstdio> #include <cstring> #include <algorithm> using namespace std; typede
2016-10-27 15:16:16 561
原创 CF 725F 贪心
F. Family Photos time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Alice and Bonnie are sisters, but they don’t like each other very much. S
2016-10-23 21:46:14 527
原创 Project Euler一句话题解(此贴持续更新)
好好搞一波数学,从PE第三页开刷101:Lagrange插值多项式 Ans:37076114526
2016-10-20 20:45:52 712
原创 CF Hello 2015 C 单调队列解决二维RMQ
C. Subrect Query time limit per test8 seconds memory limit per test512 megabytes inputstandard input outputstandard output De Prezer loves rectangles.He has a n × m rectangle which there is a numb
2016-10-07 19:00:25 529
原创 CF 528C 欧拉回路构造
C. Data Center Drama time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The project of a data center of a Big Software Company consists of n
2016-10-07 17:44:54 688
原创 CF Hello 2015 A ST表模板
A. LCM Query time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output De Prezer loves lcm (Least Common Multiple).Ha has got a sequence a1, a2, …,
2016-10-05 21:44:15 570
原创 CF 723E 巧用欧拉回路
E. One-Way Reform time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output There are n cities and m two-way roads in Berland, each road connects tw
2016-10-05 16:25:14 589
原创 CCPC长春 G Instability
InstabilityTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 0 Accepted Submission(s): 0Problem Description Long long ago, there was a prospe
2016-10-04 20:42:14 456
原创 CF 721C DAG上的dp
C. Journey time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Recently Irina arrived to one of the most famous cities of Berland — the Berlat
2016-10-04 20:32:08 554
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人