| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 366281 | model_code | Selotejp (COCI20_selotejp) | C++17 | 31 ms | 512 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); i++)
const int inf = 1e9;
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	char mat[n][m + 1];
	REP(i, n) scanf("%s", mat[i]);
	vector <int> dp(1 << m, inf), novi(1 << m);
	dp[0] = 0;
	REP(i, n) {
		REP(j, m) {
			REP(k, 1 << m) {
				if(k & (1 << j)) {
					if(mat[i][j] == '.') novi[k] = inf;
					else novi[k] = min(dp[k], dp[k ^ (1 << j)] + 1);
				}
				else {
					novi[k] = min(dp[k], dp[k ^ (1 << j)]);
					if(mat[i][j] == '#' && (j == 0 || (k & (1 << (j - 1))) || mat[i][j - 1] == '.')) novi[k]++;
				}
			}
			dp = novi;
		}
	}
	printf("%d\n", *min_element(dp.begin(), dp.end()));
	return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
