原创 poj 1861 Network

最小生成樹,要求構建和最大邊最小 1Y 實例有一條邊沒用 不過不影響 #include<stdio.h> #include<vector> #include<algorithm> #include<math.h> #define MAX

原创 Poj 2352 Stars

nY 學習了下樹狀數組 手寫的 大題能夠理解 不過確實nb,,, ~~注意樹狀數組從1開始 0~32000是個trick 要++,注意改N的範圍32001 #include<stdio.h> int LB(int x){return x&

原创 Poj 1088 滑雪

1Y DAG最長路 #include<stdio.h> #include<algorithm> int h[105][105]; int dp[105][105]; int dx[]={1,-1,0,0}; int dy[]={0,0,1

原创 第十一屆北師大程序設計競賽 by Zoo

現場賽 team06 BJTU-01 隊員:Ronnoc(5),MuQ~(4) 總共9 of 12 rank 1 以爲被北航逆襲了 結果過了D的不是他們 榜單出來了...http://www.bnuoj.com/bnucpc/summar

原创 Poj 1251 Jungle Roads

最小生成樹 Kruskal  oj有bug RE3次因爲scanf 第一次用cin輸入 沒問題 貌似是輸入的問題 以上 #include<stdio.h> #include<vector> #include<algorithm> #inc

原创 Poj 2253 Frogger

1WA於最小生成樹改用floyd 2WA於%.3lf 3PE於沒有數據間回車 4AC #include<stdio.h> #include<math.h> #include<algorithm> using namespace std;

原创 Poj 3468 A Simple Problem with Integers

需要lazy思想的線段樹 原本都關機睡覺了,來了靈感,雙重維護 聽說過lazy的想法,實現方式是自己想到的,增量+子區間總和 5Y 3*TLE 1*WA 這個可以當做自己的模板了吧~~ TLE的關鍵點在於 insert和sum的結束條件都

原创 Poj 2262 Goldbach's Conjecture

哥德巴赫猜想驗證 自檢是否是質數會tle(1TLE && 2TLE) 手寫自底向上生成質數表  3 AC #include<stdio.h> int isp[1000010]; int p[90000]; int main(){ in

原创 Poj 1258 Agri-Net

裸的最小生成樹 學習了下prim 裸打的1Y #include<stdio.h> #include<algorithm> #define INF ((int)1e9) #define N 110 using namespace std;

原创 Poj 2485 Highways

Prim 最小生成樹的最長邊 1Y 改改模板就過了 #include<stdio.h> #include<algorithm> #define INF ((int)1e9) #define N 510 using namespace s

原创 Poj 1797 Heavy Transportation

2Y 表示英文水平急劇下降.... 我的6級腫麼辦 到頭來是最大生成樹最短邊 #include<stdio.h> #include<vector> #include<algorithm> using namespace std; #def

原创 Poj 2513 Colored Sticks

歐拉圖判定(並查集,端點度數) 離散化Bsearch 1Y #include<stdio.h> #include<string.h> #include<vector> #include<algorithm> #define N 25000

原创 Poj 1459 Power Network

幾乎就是裸的最大流 對於多源點多匯點的最大流問題,只需要虛擬一個總源點總彙點即可 雖然之前在讀題的時候想到了 這樣描述出來是被題解第一行劇透的。。。 orz 1Y 用的是1273ditch的EK模板 1273就不放上來了,太水了。。。 #

原创 Uva 10397 - Connect the Campus

1Y 並查集+最小生成樹 #include<stdio.h> #include<vector> #include<algorithm> #include<math.h> #define MAX 800 struct edge{ int

原创 Poj 1308 Is It A tree

1WA於句末標點,ipad手打傷口不起 2Y 並查集 手寫離散化 學會了vector的erase+unique的用法 #include<stdio.h> #include<vector> #include<algorithm> #defi