2010年2月19日星期五

Useful Command for Novice

VIM:
:gg -G Indent all lines of codes
:%s/from/to/g Replace All

Shell:
wc -l filename Count # lines of text files

2010年2月18日星期四

Learning Progress

18/02/2010 - Separating Axis Theorem
24/02/2010 - Randomized 2D-LP - Expected O(N)
PKU 3130 How I Mathematician Wonder What You Are! (Existence of Kernel)
27/02/2010 - Dinic - O(NM^2) [+Opt]
PKU 3649 Dual Core CPU (Binary Labeling, Min-Cut)
13/03/2010 - Maximum Weight Closure by Min-Cut(N, M)
PKU 2987 Firing (Min-Cut)
21/03/2010 - Nim Game [Revisited]
PKU 3537 Crosses and Crosses
20/05/2010 - DP on Tree + Counting / Leftmost-Child-Right-Sibling / Knapsack
ICPC 4685 Succession
17/06/2010 - Discrete Logarithm - Baby Step and Giant Step Algorithm
PKU 2417 Discrete Logging
29/06/2010 - Half-Plane Intersection - O(N lg N) (ZZY)

2010年2月10日星期三

ACM ICPC World Finals 2010 - Intuition@CUHK 戰記

立志:見你地頭四題solve得咁順,我仲諗住你地會做到六題。如果第五同六題都順啲,如果whh諗到漏左check呢個case,如果ctli條f都搞掂埋,咁就有六題lu。

ctli:冇咁多「如果」。。。



話遺憾
我又唔係真係覺得極度遺憾

今日既表現
如果同過去training去比較
都差唔多係平時水準



講下戰況



一開始我開機set野 (VIM, INDENT of gedit...)
然後大家發散睇題
whh:A,D,G,J
kn:B,E,H
ctli:C,F,I

發現 G 有grid,疑似 Geom,就用 H 同 whh swap

ICPC 4455 Suffix-Replacement Grammars

ICPC 4455 Suffix-Replacement Grammars

[World Finals 2009 - Problem K]

題意
現給定 N (<=100) 項規則,每項
形式為: XY(其中 XY 等長)
意義是:若字串的後綴為 X,則可花費用 1 ,將後綴替換成 Y

求由字串 S 轉換至 T 最短路*。(其中 ST 等長)

所有字串長度最多為 20。

[* 即 最小費用,使用 "最短路" 此詞是因為描術更直觀]



樣例

規則:
BC → CD
BC → CA
BCD → CCZ
A → C

S = BBA
T = CCZ

  BBA
→ BBC (應用 "A → C")
→ BCD (應用 "BC → CD")
→ CCZ (應用 "BCD → CCZ")

Answer: 3