Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define loop(i,b,e) for(auto i=b;i<=e;i++)
- #define reloop(i,e,b) for(auto i=e;i>=b;i--)
- #define all(x) x.begin(),x.end()
- #define ll long long
- #define pb push_back
- #define mp make_pair
- #define fi first
- #define se second
- #define pf printf
- #define sf scanf
- int r,c;
- char x,m[501][501];
- int main()
- {
- cin >> r >> c;
- loop(i,0,r-1) {
- loop(j,0,c-1) {
- cin >> m[i][j];
- if(m[i][j] == '.')
- m[i][j] = 'D';
- }
- }
- loop(i,0,r-1) {
- loop(j,0,c-1) {
- if(m[i][j] == 'W') {
- if(m[i+1][j] == 'S' || m[i-1][j] == 'S' || m[i][j+1] == 'S' || m[i][j-1] == 'S') {
- pf("No");
- return 0;
- }
- }
- }
- }
- pf("Yes\n");
- loop(i,0,r-1) {
- loop(j,0,c-1)
- pf("%c",m[i][j]);
- pf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement