- 博客(8)
- 收藏
- 关注
原创 HDOJ 1425快排
手写快排居然比stl的快 #include <math.h> #include <stdio.h> #include <iostream> using namespace std; const int MAX = 1e6+10; int n,m; int num[MAX]; void swap(int &a,int &b){ a +...
2019-11-21 15:55:17
189
原创 HDOJ 6704
用AC自动机 写了个指针,直接爆内存,我人都裂开了 #include <cstdio> #include <cstring> #include <queue> #include <iostream> #include <algorithm> using namespace std; #define WORD 26 const int M...
2019-11-19 17:20:18
120
原创 AC自动机模板
前置知识trie树,KMP算法 1.构建trie树 根据关键字构建trie树,需要标记当前字母是否为单词结尾 2.建立fail指针 与kmp相同,当当前位置不匹配时,循环找父节点的fail指针,直到该指针为根节点为止 若找到,则当前fail指针指向该指针的next[i] 若未找到,则当前指针fail指针指向根节点 3.在trie树上跑kmp 需要注意当前位置若匹配成功需要进行当前位置的fail指针...
2019-11-15 17:36:13
129
转载 Python3 ACM基础输入模板
案例一:输入字符串分割并转化成多个int数值 a, b= map(int, input().split()) try: while True: a, b= map(int, input().split()) print(a+b) except EOFError: pass 案例二:输入一个数值转化为int t =int(input().strip()) t =int(...
2019-11-04 17:42:49
658
原创 HDU1005-矩阵快速幂模板
#include <stdio.h> #include <algorithm> #include <vector> #include <iostream> using namespace std; #define MOD 7 int a,b,n; bool skip; int A[2][2],C[2][2],B[2]; void init(){ ...
2019-11-04 17:06:03
101
原创 HDOJ 1863(并查集+Kruskal)
HDOJ 1863 package com.neuedu; import java.util.ArrayList; import java.util.Scanner; import java.util.Stack; import java.util.Collections; import java.util.Comparator; class node{ public int to,v; publ...
2019-11-01 17:59:41
167
原创 并查集
并查集错误点 未分清并查集中路径压缩时应该更新的节点,应注意每次更新集合时应更新祖先节点 #include <stdio.h> #include <iostream> using namespace std; int n,m; int f[10010]; int z,x,y; int dfs(int x){ if(f[x] == x)return x; ...
2019-04-23 11:59:41
126
原创 哈希表
哈希表洛谷3370 字符串哈希 洛谷3370 字符串哈希 思考: 1.哈希是在一定错误率的基础上进行的 2.哈希的模数最好是质数 3.使用自然溢出时应&0x7fffffff负数转正 #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> u...
2019-04-22 15:01:15
190
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅