# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
366281 | model_code | Selotejp (COCI20_selotejp) | C++17 | 31 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (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... |