http://codeforces.com/contest/699
題目:
pA : http://codeforces.com/contest/699/problem/A
pB : http://codeforces.com/contest/699/problem/B
pC : http://codeforces.com/contest/699/problem/C
pD : http://codeforces.com/contest/699/problem/D
pE : http://codeforces.com/contest/699/problem/E
pF : http://codeforces.com/contest/699/problem/F
我AC的code :
pA : http://codeforces.com/contest/699/submission/19263590
pB : http://codeforces.com/contest/699/submission/19235904
pC : http://codeforces.com/contest/699/submission/19239284
pD : http://codeforces.com/contest/699/submission/19250329
詳解:
pA :
枚舉每個點,如果這個點是L和下個點是R,更新答案。O(n)
pB :
記錄每行每列有多少個*,枚舉所有的點(x,y)檢查,如果row[x] + col[y] = sum,那就okay
pC :
開三條dp陣列,紀律最後一天是rest, gym, contest所需要rest的min。更新的方法是rest-->rest,gym,contest ; gym-->rest,contest, contest-->gym,rest
pD :
這題頗精彩XD
看code自己想XD
好啦,就是
想辦法把圖中的任意邊連到根,詳細作法可以參考MST的Kruskal做法(我是這樣套用啦)
沒有留言:
張貼留言