0w1

Entries from 2016-04-04 to 1 day

CFR 20 C. Dijkstra? ( Dijkstra )

Problem - 20C - Codeforces 根本裸題。。 #include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; const int MAXM = 1e5 + 5; const int MAXW = 1e6 + 6; typedef long long ll; typedef pair< int, int > pii; typedef pair< ll, int > pli; int n, m;</bits/stdc++.h>…

CFR 277 1A. Learning Languages ( Union Find )

Problem - 277A - Codeforces 很顯然可以將每個人分別看成點,兩個不同分量若各自有一個人能說共同語言,就能把兩個分量所有點合併。假設所有人都會說至少一種語言,答案就是分量的數量減一。如果有人不會任何語言,那麼他們都必須學一種語言,所以得另外加…

CFR 238 1C. World Eater Brothers ( Tree DP )

Problem - C - Codeforces 基本上和這道題是相同的概念 CFR 219 D. Choosing Capital for Treeland ( Tree DP ) - 0w1 不過這題的要點在於意識到樹的唯一路徑性質使得選擇任一條邊後兩端一定可以各自形成一顆子樹。因此只要枚舉所有邊,再各自處理所有情況就…