답안 #966808

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
966808 2024-04-20T11:52:24 Z Pring Bold (COCI21_bold) C++17
50 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif

#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;

const int MXN = 105;
int n, m;
string s[MXN];

void miku() {
    auto check = [&](int i, int j) -> bool {
        bool f = (s[i][j] == '#');
        if (i) f |= (s[i - 1][j] == '#');
        if (j) f |= (s[i][j - 1] == '#');
        if (i && j) f |= (s[i - 1][j - 1] == '#');
        return f;
    };
    cin >> n >> m;
    FOR(i, 0, n) cin >> s[i];
    FOR(i, 0, n) {
        FOR(j, 0, m) {
            if (check(i, j)) cout << '#';
            else cout << '.';
        }
        cout << '\n';
    }
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    miku();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct