原创 TREAP示例代碼(排序)

#include<iostream> #include<cstdio> #include<cstdlib> using namespace std; struct node{ int v,w; node *f,*l,*r; node

原创 強聯通分量的KOSARAJU算法

轉自NOCOW 參考:http://m.blog.csdn.net/article/details?id=45692005 #include <iostream> using namespace std; const int MAXV

原创 線段樹入門三道題

//POJ 3264 #include <iostream> #include <cstdio> #include <cmath> using namespace std; #define FOR( i , a ,

原创 POJ1273網絡流

//Edmonds_Karp #include<iostream> #include<queue> using namespace std; const int N=201; const int INF=99999999; int n,m

原创 【合併果子】的兩種方法

哈夫曼樹+堆 #include<iostream> #include<cstdio> const int maxn=10000+10; using namespace std; int a[maxn]; int main(){ int

原创 Python 程序設計快速入門簡易教程

Python 程序設計快速入門簡易教程Python語言快速檢索一些需要知道的事一個簡單的Python程序Python的基本數據類型Python的基本運算符Python的常用函數import 庫的用法分支語句循環結構字符串列表的使用

原创 猴子選大王改編;關於環形鏈表的建立,刪除,插入操作演示

#include<iostream> using namespace std; struct node{ int x; struct node *next,*pre; node(){ x=0;next=NULL;pre=NUL

原创 線段填色(線段樹LAZY)

/* title:線段填色 輸入:n m x1 y1 x2 y2 .... xm ym 輸出:1 xxx 3 xxx */ #include<iostream> #include<cst

原创 HDU1698 Just a Hook--線段樹LAZY操作

#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> using namespace std; #define ll l

原创 luogu1396 二分答案或者並查集水題

有m條大道連接n個區,一條大道將兩個區相連接,每個大道有一個擁擠度。小明的媽媽雖然很着急,但是不願意擁擠的人潮衝亂了她優雅的步伐。所以請你幫她規劃一條從s至t的路線,使得經過道路的擁擠度最大值最小。 首先是二分答案做法: #includ

原创 KM最容易看懂的教程和參考程序

現在有N男N女,有些男生和女生之間互相有好感,我們將其好感程度定義爲好感度,我們希望把他們兩兩配對,並且最後希望好感度和最大。 怎麼選擇最優的配對方法呢? 首先,每個女生會有一個期望值,就是與她有好感度的男生中最大的好感度。男生呢,期

原创 ZOJ1610【未完成】

以下代碼是錯的,僅用於存儲而用 #include<iostream> #include<cstdio> #include<cstring> const int maxn=8000+10; #define mid ((s+t)>>1)

原创 HDU1698(線段樹LAZY)

/* TASK:hdu1698 */ #include<iostream> #include<cstdio> const int maxn=100000+10,maxm=100000+10; using namespace std;

原创 [USACO5.3]校園網Network of Schools 強連通分量

#include <iostream> #include <cstring> using namespace std; const int MAXN = 100+5; int g[MAXN][MAXN], dfn[MAXN], num[M

原创 USACO5.1凸包參考代碼

#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int maxn=10000+5; st