0w1

Entries from 2016-02-22 to 1 day

CF 527C Glass Carving ( STL set )

Problem - C - Codeforces The key is to realize that the largest area is the largest width * largest height. They can be maintained with STL set / multiset separately. For each of them, prepare a set to keep record of the existing lines. Wh…

UVA 10891 Game of Sum ( DP )

UVa Online Judge 最佳策略其實就是留給對手最差的狀態,從這部份著手,很容易得到轉移方程: dp( i, j ) = sum( i, j ) - min{ 0, min{ dp( k, j ), dp( i, k ) | Ɐ i ≤ k ≤ j } } 用言語表達就是要嘛左邊取來要嘛右邊取來,甚至是全取( 留 0給對手 )會讓對…

UVA 1267 Network ( DFS )

把需要被覆蓋的節點押進該深度的節點表裡,之後依次選擇深度最深的為覆蓋的節點,用貪婪的思維找尋其 k級祖先設置伺服器。注意題目只要求葉節點覆蓋。 #include <bits/stdc++.h> using namespace std; const int MAXN = 1000 + 3; int n, s, k; vector<int> G[MAXN]; vector<int> dept</int></int></bits/stdc++.h>…