原创 並查集

並查集(Union-find Sets),用於處理不相交集合的查找與合併問題。一些常見的用途有求連通子圖、求最小生成樹的 Kruskal 算法和求最近公共祖先(Least Common Ancestors, LCA)等。 並查集的基本操作

原创 D - 十四大師 (簡單的bfs也可以用dfs)

https://vjudge.net/contest/242868#problem/D 注意加減乘除後的數據範圍,以及next的邊界,注意時時要用v[  ]標記已經便遍歷過的  #include <iostream> #include

原创 B - 迷宮路徑

https://vjudge.net/contest/242868#problem/B 注意題的要求要及時結束遞歸!! #include <iostream> #include <cstdio> #include <string> #i

原创 Longest Ordered Subsequence

http://poj.org/problem?id=2533 Description A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequen

原创 F - Team Queue(上)

https://vjudge.net/contest/240386#problem/F Queues and Priority Queues are data structures which are known to most comp

原创 B - Dropping tests

今年有 n 場 ACM-ICPC 競賽,小明每場都有資格參加。第 i 場競賽共有 b[i] 道題。小明預測第 i 場他能做出 a[i] 道題。爲了讓自己看着更“大佬”一些,小明想讓自己平均做出的題數越大越好,也就是最大化大佬度,大佬度的定

原创 Bicycle Race(幾何數學)

http://codeforces.com/problemset/problem/659/D D. Bicycle Race Maria participates in a bicycle race. The speedway takes

原创 STL總覽

一、STL簡介 STL(Standard Template Library,標準模板庫)是惠普實驗室開發的一系列軟件的統稱。它是由Alexander Stepanov、Meng Lee和David R Musser在惠普實驗室工作時所開

原创 STL(容器)

轉載自http://blog.csdn.net/phunxm/article/details/5081472 容器的概念 所謂STL容器,即是將最常運用的一些數據結構(data structures)實現出來。 容器是指容納特定類型對象的

原创 STL(map)

轉載自https://www.cnblogs.com/fnlingnzb-learner/p/5833051.html Map是STL的一個關聯容器,它提供一對一(其中第一個可以稱爲關鍵字,每個關鍵字只能在map中出現一次,第二個可能稱爲

原创 F - Team Queue (下)

https://vjudge.net/contest/240386#problem/F 看了題解後改的(還是WA): #include <iostream> #include <string> #include <algorithm>

原创 A - Where is the Marble? (vector)

Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them. At the beginning

原创 Rails (棧)

https://vjudge.net/contest/240386#problem/C There is a famous railway station in PopPush City. Country there is incredi

原创 G - Ugly Numbers

https://vjudge.net/contest/240386#problem/G Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequen

原创 Tanya and Toys (貪心)

http://codeforces.com/problemset/problem/659/C In Berland recently a new collection of toys went on sale. This collecti