{"problem":{"name":"[ICPC 2022 Xi'an R] Cells Coloring","description":{"content":"You are given an $n \\times m$ grid. Some of the cells are obstacles, the others are empty. Choose a non-negative integer $k$ and color all empty cells with $k+1$ colors $0, 1, 2, \\ldots k$. You can no","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P5"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9359"},"statements":[{"statement_type":"Markdown","content":"You are given an $n \\times m$ grid. Some of the cells are obstacles, the others are empty. Choose a non-negative integer $k$ and color all empty cells with $k+1$ colors $0, 1, 2, \\ldots k$. You can not color two cells in the same row or same column with the same **non-zero** color. \n\nYou are given two non-negative integers $c$ and $d$. For a coloring plan, define $z$ as the number of the cells with color $0$. Define the cost of the plan is $ck+dz$.\n\nFind the minimum cost.\n\n## Input\n\nThe first line contains four integers $n$, $m$ ($1\\leq n, m\\leq 250$), $c$ and $d$ ($0\\leq c, d\\leq 10 ^ 9$).\n\nThe $i$-th line of the next $n$ lines contains a string of $m$ characters. The $j$-th character is `*` if the cell in the $i$-th row and the $j$-th column is an obstacle. The $j$-th character is `.` if the cell in the $i$-th row and the $j$-th column is empty.\n\n## Output\n\nOutput a line with a single number, representing the answer.\n\n[samples]\n\n## Note\n\n**Source**: The 2022 ICPC Asia Xi'an Regional Contest Problem B.\n\n**Author**: csy2005.","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9359","tags":["2022","三分","网络流","O2优化","二分图","ICPC","西安"],"sample_group":[["3 4 2 1\n.***\n*..*\n**..\n","4\n"],["3 4 1 2\n.***\n*..*\n**..\n","2"]],"created_at":"2026-03-03 11:09:25"}}