
Template
Irish_Moonshine
沐月
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Tarjian【Template】
#include<iostream>#include<cstring>using namespace std;const int M = 1e5 + 7;const int N = 1e5 + 7;struct node { int v; int nxt;}e[M];int head[N], cnt;int p[N], st[N], id, top, scc;int原创 2017-10-18 09:16:31 · 283 阅读 · 0 评论 -
HDU 1532 Drainage Ditches【HLPP网络流(最高标号预流推进)】
HDU 1532 Drainage Ditches最大流裸题(同POJ 1273)代码做了我所能理解的,比较详尽的注释。参考教程:最大流算法-最高标号预流推进(HLPP)【PS:这大哥为了缩行,太可怕了QAQ】#include<iostream>#include<cstring>#include<cstdio>#include<algor...原创 2019-07-10 19:32:48 · 448 阅读 · 0 评论 -
Python 基本排序算法基础实战【O(nlogn or C*n):归并排序、快速排序、桶排序(基数排序)、堆排序、希尔排序】
C++实现请参考:近乎所有排序——Irish_MoonshinePython实现:其中堆排序完全是按照面向对象设计的,写起来感觉就很繁琐,引起强烈不适。如有更优或更简的正规实现方法,望各位巨巨指教!!!from random import *maxn = 100000 + 10a = [-1,9,1,2,3,8,16,85,24,984,35198,168,325,35384,84,6...原创 2019-06-20 20:47:04 · 298 阅读 · 0 评论 -
2018 Multi-University Training Contest 5 1005 Everything Has Changed【圆交】
http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1005&cid=806题意:给出一个母圆,给出m个子圆来切割子圆,求最后母圆被切割后的周长。题目保证所有的子圆互不相交。如果子圆内切与母圆,那么他对于答案的贡献是他的圆周长。 如果子圆相离、内含、外切与母圆,贡献为0;注意有优弧与劣弧。#includ...原创 2018-08-06 18:05:14 · 221 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第三场)J Distance to Work【二分+圆交】
https://www.nowcoder.com/acm/contest/141/J给出一个多边形,多边形内区域为城市。 给出几个工作地点,一个工作地点给出一个比例p/q,表示相比于所有的可能,我这个工作范围恰好站总生活面积的p/q。我们可以二分圆的半径,使公共部分面积=p/q∗p/q∗p/q*城市面积。圆与多边形交可以套用板子。#include<bits/stdc++.h...原创 2018-07-27 13:34:09 · 236 阅读 · 0 评论 -
最小树形图【Template】
摘自https://www.cnblogs.com/vongang/archive/2012/07/18/2596851.html#include <iostream>#include <cstdio>#include <cmath>#include <vector>#include <cstring>#include ...转载 2018-05-05 04:02:43 · 289 阅读 · 0 评论 -
跳舞链——精确覆盖问题【template】
学习并参考自 http://blog.youkuaiyun.com/qq_32400847/article/details/51831009#includeusing namespace std;#define maxm 110#define maxn 110#define Max 10050int Row[maxn], Col[maxm], U[Max], D[Max], R[Max], L原创 2018-01-20 11:10:25 · 361 阅读 · 0 评论 -
HDU 3074 Multiply game【线段树||zkw线段树||扩展gcd*乘法逆元||欧拉定理】
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2818 Accepted Submission(s): 1002Problem DescriptionTired of playing computer games, alpc23原创 2017-11-27 16:37:17 · 401 阅读 · 0 评论 -
lucas【template】
Lucas(n,m,p)=c(n%p,m%p)*Lucas(n/p,m/p,p) 相关性质还在研究中,template:#include<iostream>#include<cstring>#include<cstdio>using namespace std;#define ll long long int//lucas 上限为p为1e5左右ll qkm_mod(ll a, ll原创 2017-12-02 09:43:01 · 225 阅读 · 0 评论 -
单调栈【Template】
POJ 3250 单调递增栈#include<iostream>#include<string>#include<algorithm>#include<functional>using namespace std;#define Irish_Moonshine main#define maxn 1000000#define LL long long intLL stack[maxn]原创 2017-10-23 19:26:37 · 250 阅读 · 0 评论 -
单调队列【Template】
#include<iostream>#include<string>#include<algorithm>#include<functional>using namespace std;#define Irish_Moonshine main#define MAXN 1000000class MonotonicQueue{public: MonotonicQueue(voi原创 2017-10-23 18:40:28 · 252 阅读 · 0 评论 -
线性筛法求素数【Template】
#include<iostream>#include<cstring>#include<iomanip>using namespace std;const int maxn = 1e3;int vis[maxn];int prime[maxn];int len; void getprim(){ memset(vis, 0, sizeof(vis)); memset(原创 2017-10-22 16:08:55 · 330 阅读 · 0 评论 -
kmp【Template】
#include<iostream>#include<cstdio>using namespace std;void kmp_pre(char x[], int m, int next[]){ int i, j; j = next[0] = -1; i = 0; while (i < m) { while (-1 != j&&x[i]原创 2017-10-20 12:18:23 · 271 阅读 · 0 评论 -
近乎所有排序算法【Template】
#include <cstdio>#include <stdlib.h>#include <time.h> using namespace std;const int maxn = 100000 + 10;int T, n;int a[maxn];void InsertSort(int L, int R) { for (int i = L; i <= R; i ++) { fo原创 2017-10-20 11:55:27 · 388 阅读 · 0 评论 -
拓扑排序【Template】
#include<iostream>#include<cstring>#include<queue>using namespace std;const int N = 1e5 + 10;struct Edge{ int u, v; int nx;}e[N];int head[N], cnt, n, m;int vis[N]; int sz; int flag;in原创 2017-10-18 12:56:15 · 232 阅读 · 0 评论 -
vector【Template】
#include<vector>#include<iostream>#include<cstring>using namespace std;vector<int> a;//声明一个int型向量avector<int> b(10);//声明一个初始大小为10的向量vector<int> m(10);vector<int> k(10, 1);//声明一个初始大小为10且初始值都为1的向量原创 2017-10-18 09:55:09 · 558 阅读 · 0 评论 -
POJ 1273 Drainage Ditches【EK最大流】
Drainage Ditches Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 82146 Accepted: 31911 DescriptionEvery time it rains on Farmer John’s fields, a pond forms over Bessie’s fa...原创 2018-03-28 18:15:59 · 228 阅读 · 0 评论