原创 pipioj 1034: 字典序最小的子序列(貪心)

1 #define bug(x) cout<<#x<<" is "<<x<<endl 2 #define IO std::ios::sync_with_stdio(0) 3 #include <bits/stdc++.h> 4 u

原创 pipioj 1241: 01揹包(中途相遇法)

1 #define bug(x) cout<<#x<<" is "<<x<<endl 2 #define IO std::ios::sync_with_stdio(0) 3 #include <bits/stdc++.h> 4 u

原创 pipioj 1175: 貨運費用(最短路)

1 #define IO std::ios::sync_with_stdio(0) 2 #include <bits/stdc++.h> 3 using namespace std; 4 #define mk make_pair

原创 POJ 1523 (Tarjan求關節點)

http://poj.org/problem?id=1523 1 #define IO std::ios::sync_with_stdio(0) 2 #include <iostream> 3 #include <vector>

原创 P3366 【模板】最小生成樹(Prim)

https://www.luogu.com.cn/problem/P3366 1 #define IO std::ios::sync_with_stdio(0) 2 #include <bits/stdc++.h> 3 #defin

原创 P3366 【模板】最小生成樹 (Kruskal)

1 #define IO std::ios::sync_with_stdio(0) 2 #include <bits/stdc++.h> 3 #define pb push_back 4 using namespace std;

原创 線索二叉樹(中序)

1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef int ElemType; 4 5 typedef struct ThrNode{ 6 Elem

原创 Dijkstra(n^2版)

1 #define IO std::ios::sync_with_stdio(0) 2 #include <bits/stdc++.h> 3 #define pb push_back 4 using namespace std;

原创 排序二叉樹刪除節點、二叉樹後序、先序非遞歸遍歷

1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef char ElemType; 4 5 typedef struct BiNode{ 6

原创 二叉樹第k層節點數

1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef int ElemType; 4 5 typedef struct Node{ 6 ElemTy

原创 pipioj 1373: 在每個樹行中找最大值

http://www.pipioj.online/problem.php?id=1373 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef int ElemTyp

原创 pipioj 1295: 一元多項式乘法

http://www.pipioj.online/problem.php?id=1295 1 #define bug(x) cout<<#x<<" is "<<x<<endl 2 #define IO std::ios::sync

原创 pipioj 1265: 最近公共祖先

http://www.pipioj.online/problem.php?id=1265 1 #define bug(x) cout<<#x<<" is "<<x<<endl 2 #define IO std::ios::sync_w

原创 pipioj 1292 中綴表達式轉後綴表達式II

1 #define bug(x) cout<<#x<<" is "<<x<<endl 2 #include<bits/stdc++.h> 3 using namespace std; 4 const int N=2e6+10;

原创 pipioj 1291 中綴表達式轉後綴表達式I

1 #define bug(x) cout<<#x<<" is "<<x<<endl 2 #include<bits/stdc++.h> 3 using namespace std; 4 const int N=1000; 5