#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
signed main(){
fastio
int n,m;
cin >> n >> m;
char grid[n+2][m+2], grid2[n+2][m+2];
for(int i = 1;i <= n;i++){
for(int j = 1;j <= m;j++){
cin >> grid[i][j];
if(grid[i][j]=='#'){
grid2[i][j] = grid2[i+1][j] = grid2[i][j+1] = grid2[i+1][j+1] = '#';
}
}
}
for(int i = 1;i <= n;i++){
for(int j = 1;j <= m;j++){
cout << (grid2[i][j]=='#' ? '#' : '.');
}
cout << "\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |