#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int dx[]={0,1,1} ;
int dy[]={1,0,1} ;
char s[200][200] ;
bool vis[200][200] ;
int n , m ;
int main()
{
cin >> n >> m ;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin >> s[i][j] ;
if(s[i][j]=='#')vis[i][j]=true;
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(s[i][j]=='#'&&vis[i][j])
{
for(int k=0;k<3;k++)
{
int nx = dx[k] + j ;
int ny = dy[k] + i ;
if(nx<m&&ny<n)
s[ny][nx]='#' ;
}
}
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cout<<s[i][j] ;
}
cout<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |