#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fi first
#define se second
#define ld long double
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N, M;
cin >> N >> M;
char a[N][M];
for (int i = 0; i < N; i++) {
string h;
cin >> h;
for (int j = 0; j < M; j++) {
a[i][j] = h[j];
}
}
for (int i = N - 2; i >= 0; i--) {
for (int j = M - 2; j >= 0; j--) {
if (a[i][j] == '#') {
a[i + 1][j + 1] = '#';
a[i + 1][j] = '#';
a[i][j + 1] = '#';
}
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
cout << a[i][j];
}
cout << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |