程式隨筆

Never give up!


  • Home

  • Categories

  • Archives

  • Tags

HUD5438

Posted on 2017-01-20 | In Competitive Programming , HDU

HUD 5438 Ponds

Solution Sketch

Key: Use DFS and yank nodes with $total\ degree = 1$

Read more »

POJ1655

Posted on 2017-01-19 | In Competitive Programming , POJ

Balancing Act

Solution sketch

在樹上做DP,基本上是挑一個點當作 root 開始 DFS。維護 連同節點$u$在內已經拜訪過的子樹結點總數 和 拔掉節點$u$後最大的子數大小,就可以求出答案。

Read more »

UVa 10304

Posted on 2017-01-18 | In Competitive Programming , UVa

Optimal Binary Search Tree

Solution sketch

Just like cutting stick!! :)

Read more »

POJ1742

Posted on 2017-01-18 | In Competitive Programming , POJ

Coins

Solution sketch

有限背包問題,但是正常做會TLE QQ!(原理請看解說)

Read more »

POJ1276

Posted on 2017-01-18 | In Competitive Programming , POJ

Cash Machine

Solution sketch

有限背包問題,需要使用二進制拆解!(請看解說)

Read more »

POJ3624

Posted on 2017-01-18 | In Competitive Programming , POJ

Charm Bracelet

Solution sketch

0/1背包問題,需要優化記憶體使用量!

Read more »

Codeforces Technocup 2017 Elimination Round 1 Problem D

Posted on 2017-01-17 | In Competitive Programming , Codeforces

T-shirts Distribution

Solution sketch

Let the source node be $0$, shirt nodes from small to large are $[1, 6]$ respectively, participant nodes are $[7, 7 + n)$, and sink node be $7 + n$.

Read more »

UVa 820

Posted on 2017-01-17 | In Competitive Programming , UVa

Internet Bandwidth

Solution sketch

用 Adjacency matrix 存圖後(因為點數很少),之後跑一次 Ford Fulkerson 即可。

Read more »

Codeforces Round 284 Div2 Problem C

Posted on 2017-01-17 | In Competitive Programming , Codeforces

Array and Operations

Solution sketch

Read more »

Codeforces 2015-2016 ACM-ICPC, NEERC, Southern Subregional Contest Problem F

Posted on 2017-01-17 | In Competitive Programming , Codeforces

Gourmet and Banquet

Solution sketch

Construct the flow graph with 1 super source, 10000 time nodes, n dish nodes, and 1 super sink.

Connect super source to all time nodes with cap 1. Connect dish’s time $[a_i, b_i)$ to dish’s node, with cap 1. Connect all dish nodes to the super sink with cap value from binary search.

Read more »
1…345…7
Henry Tseng

Henry Tseng

64 posts
18 categories
57 tags
© 2017 Henry Tseng
Powered by Hexo
Theme - NexT.Pisces