上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

2019年3月1日

CodeForces - 1105D 多源搜索

摘要: #include using namespace std; typedef long long ll; struct node{ int x,y; ll setp; }; queue Q,border[10]; const int maxn=1005; char a[maxn][maxn]; int vis[maxn][maxn]; int n,m,p; ll ans[10],s... 阅读全文

posted @ 2019-03-01 16:27 欣崽 阅读(550) 评论(0) 推荐(0) 编辑

最大独立集模板

摘要: #include #include #include using namespace std; const int maxn=55; int n; bool g[maxn][maxn]; bool found; int len[maxn],list[maxn][maxn],ans,mc[maxn]; void dfs(int size) { if(len[size]==0... 阅读全文

posted @ 2019-03-01 16:09 欣崽 阅读(336) 评论(0) 推荐(0) 编辑

2019年2月27日

数学公式

摘要: In mathematics, Cayley's formula is a result in graph theory named after Arthur Cayley. It states that for every positive integer n, the number of tre 阅读全文

posted @ 2019-02-27 17:06 欣崽 阅读(287) 评论(0) 推荐(0) 编辑

CodeForces - 1109A

摘要: #include #include #include #include using namespace std; int n; long long ans,pre; map,int> M; main() { scanf("%d",&n); cin>>pre; M[{1,pre}]++; for(int i=2,x;i<=n;i++){ scanf... 阅读全文

posted @ 2019-02-27 16:37 欣崽 阅读(207) 评论(0) 推荐(0) 编辑

2019年2月26日

差分数组

摘要: 思想不错,但感觉很鸡肋 https://www.cnblogs.com/aininot260/p/9304521.html 这道题运用了差分数组 http://codeforces.com/blog/entry/65079 阅读全文

posted @ 2019-02-26 21:55 欣崽 阅读(129) 评论(0) 推荐(0) 编辑

退背包

摘要: https://www.cnblogs.com/L-Memory/p/7074261.html 阅读全文

posted @ 2019-02-26 16:51 欣崽 阅读(196) 评论(0) 推荐(0) 编辑

2019年2月23日

杜教筛BM

摘要: #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,a,n) for (int i=a;i=a;i--) #define pb push_back #define mp make_p... 阅读全文

posted @ 2019-02-23 15:47 欣崽 阅读(258) 评论(0) 推荐(0) 编辑

2019年2月14日

Petya and Array CodeForces - 1042D

摘要: 很不错的一道题 给你一个长度为n的数组,问共有多少个区间满足区间之和小于给定的数t 这种题一般做法肯定是枚举,固定左端点枚举右端点,枚举的过程需要优化,否则就是n方 这道题我先求一个前缀和,然后逆着枚举,显然问题转化为了对于一个数,如果寻找他右边的数哪些小于它+t,这就转化为了区间求和,可以树状数组 阅读全文

posted @ 2019-02-14 12:02 欣崽 阅读(158) 评论(0) 推荐(0) 编辑

2019年2月11日

AC自动机模板

摘要: const int SIGMA_SIZE = 26; const int MAXNODE = 11000; struct AhoCorasickAutomata { int ch[MAXNODE][SIGMA_SIZE]; int f[MAXNODE]; // fail函数 int val[MAXNODE]; // 每个字符串的结尾结点都有一个非0的val ... 阅读全文

posted @ 2019-02-11 21:50 欣崽 阅读(159) 评论(0) 推荐(0) 编辑

KMP模板

摘要: struct KMP { void print() { } 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... 阅读全文

posted @ 2019-02-11 21:49 欣崽 阅读(156) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

导航