#include<cstdlib>#include<iostream>#include<cstdio>#include<cmath>#include<set>#include<vector>#include<cstring>#include <algorithm>#define LL long long#define inf 0x7fffffff#define E 1e-9#define M 100#
我的方法:#include<cstdlib>#include<iostream>#include<cstdio>#include<cmath>#include<set>#include<cstring>#include <algorithm>#define inf 0x7fffffff#define N 6005#define MIN 1e-11#define M 100#define LL long
#include<cstdlib>#include<iostream>#include<cstdio>#include<cmath>#include<set>#include<cstring>#include <algorithm>#define inf 0x7fffffff#define N 450000#define MIN 1e-11#define M 100#define LL long
題意:給你一些機器指令,某些有先後順序(若A->B,C->B則必須A、C執行完才能執行B),且有安全距離(若A->B 距離n)那麼必須在從A執行算起n時間,才能執行B,一次可以運行多個指令,指令的完成只花費1,最後求執行完所有指令所需的最短的時間。思想:求到達各點的最大值(所有能到達該點的花費的最大值)的最大值(即所有點的最大值)。解法:①純遞迴搜尋:這是最簡單直觀的做法,從入度為0點開始搜尋,記錄每點的最大值,最後求所有點的最大值即可。 ②
#include<cstdlib>#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include <algorithm>#include<vector>#include<set>#define LL long long#define inf 0x7fffffff#define E 1e-9#define M 100#
Lost CowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4375 Accepted: 2736DescriptionN (2 <= N <= 8,000) cows have unique brands in the range 1..N. In a spectacular display of poor judgment, they visited the neighborhood 'watering
#include<cstdlib>#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include <algorithm>#include<set>#include<map>#define LL long long#define inf 0x7fffffff#define E 1e-9#define M
http://www.acdream.net/problem.php?id=1042題目大意:(把物種和分類都看成節點。)有一顆未知樹,一人每次詢問兩個葉子節點,另一個人回答其lca,判回答之間是否有矛盾。解法:將每條陳述按照lca的深度由深到淺排序,然後掃一遍開始並查集。比如說現在搞到這條陳述:x y a,那麼查到xy的根節點 x_father
#include<cstdlib>#include<iostream>#include<cstdio>#include<cmath>#include<set>#include<cstring>#include <algorithm>#define inf 0x7fffffff#define N 10000#define MIN 1e-6//至少是6,5的話就錯了!#define M 100#define LL