QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#794562#1798. Screamers in the StormI_be_wannaAC ✓1ms3824kbC++202.9kb2024-11-30 14:56:152024-11-30 14:56:16

Judging History

你现在查看的是最新测评结果

  • [2024-11-30 14:56:16]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3824kb
  • [2024-11-30 14:56:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ii = pair<int,int>;
#define F(i,a,b) for (int i = (int)(a); i < (int)(b); ++i)

const int GRASS_TIMER =  3;
const int SHEEP_TIMER =  5;
const int WOLF_TIMER  = 10;

void printState(const vector<string> & board, const vector<vector<int>> & grass, const vector<vector<int>> & hunger) {
  int rows = board.size();
  int cols = board[0].size();
  F(r, 0, rows) {
    F(c, 0, cols) {
      if (board[r][c] != '.')
        cout << board[r][c];
      else if (grass[r][c] < 0)
        cout << "*";
      else if (grass[r][c] >= GRASS_TIMER)
        cout << "#";
      else
        cout << ".";
    }
    cout << endl;
  }
}

void makeMove(vector<string> & board, vector<vector<int>> & grass, vector<vector<int>> & hunger) {
  int rows = board.size();
  int cols = board[0].size();
  vector<string> newBoard(rows, string(cols, '.'));
  auto newGrass = grass;
  vector<vector<int>> newHunger(rows, vector<int>(cols));
  // move sheep
  F(r, 0, rows) {
    F(c, 0, cols) {
      if (board[r][c] == 'S') {
        newHunger[(r+1)%rows][c] = hunger[r][c];
        newBoard [(r+1)%rows][c] = 'S';
      }
    }
  }
  // move wolves
  F(r, 0, rows) {
    F(c, 0, cols) {
      if (board[r][c] == 'W') {
        newHunger[r][(c+1)%cols] = hunger[r][c];
        if (newBoard[r][(c+1)%cols] == 'S') {
          // eat sheep
          newGrass [r][(c+1)%cols] = -1e9;
          newHunger[r][(c+1)%cols] = -1;
        }
        newBoard[r][(c+1)%cols] = 'W';
      }
    }
  }
  // eat grass
  F(r, 0, rows) {
    F(c, 0, cols) {
      if (newBoard[r][c] == 'S' && newGrass[r][c] >= GRASS_TIMER) {
        newHunger[r][c] = -1;
        newGrass [r][c] = -1;
      }
    }
  }
  // grow hunger
  F(r, 0, rows) {
    F(c, 0, cols) {
      if (newBoard[r][c] == 'S' || newBoard[r][c] == 'W')
        ++newHunger[r][c];
    }
  }
  // die of hunger
  F(r, 0, rows) {
    F(c, 0, cols) {
      if (newBoard[r][c] == 'S' && newHunger[r][c] >= SHEEP_TIMER) {
        newGrass [r][c] = -1e9;
        newHunger[r][c] = 0;
        newBoard [r][c] = '.';
      }
      if (newBoard[r][c] == 'W' && newHunger[r][c] >= WOLF_TIMER) {
        newGrass [r][c] = -1e9;
        newHunger[r][c] = 0;
        newBoard [r][c] = '.';
      }
    }
  }
  // grow grass
  F(r, 0, rows) {
    F(c, 0, cols) {
      ++newGrass[r][c];
    }
  }
  swap(board, newBoard);
  swap(grass, newGrass);
  swap(hunger, newHunger);
}

int main() {
  int turns, rows, cols;
  cin >> turns >> rows >> cols;
  vector<string> board(rows);
  for (auto & row : board)
    cin >> row;

  vector<vector<int>> grass (rows, vector<int>(cols));
  vector<vector<int>> hunger(rows, vector<int>(cols));
  while (turns--) {
    // printState(board, grass, hunger);
    // cout << endl;
    makeMove(board, grass, hunger);
  }
  printState(board, grass, hunger);
  cout << endl;
  
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3520kb

input:

5 4 4
....
W...
..W.
....

output:

####
#W##
###W
####


result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

3 4 1
.
.
.
.

output:

#
#
#
#


result:

ok 4 lines

Test #3:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

5 1 4
.W..

output:

##W#


result:

ok single line: '##W#'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

1 5 4
..WW
....
.S.S
....
....

output:

W..W
....
....
.S.S
....


result:

ok 5 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

2 5 1
.
.
.
.
.

output:

.
.
.
.
.


result:

ok 5 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

13 2 4
....
.SS.

output:

#SS#
#..#


result:

ok 2 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

6 4 3
W..
..S
.W.
...

output:

W##
###
#W*
###


result:

ok 4 lines

Test #8:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

15 3 1
.
.
.

output:

#
#
#


result:

ok 3 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

3 5 3
...
.S.
...
W.W
W..

output:

###
###
###
W*W
W##


result:

ok 5 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

9 2 3
...
W..

output:

###
W##


result:

ok 2 lines

Test #11:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

14 6 4
....
...S
....
....
....
..SW

output:

##.#
##S#
####
####
####
#*.*


result:

ok 6 lines

Test #12:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

8 1 1
.

output:

#


result:

ok single line: '#'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3476kb

input:

8 1 4
S...

output:

S###


result:

ok single line: 'S###'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

15 4 4
.SS.
S...
.SSS
...S

output:

S##.
#SSS
.##S
.SS#


result:

ok 4 lines

Test #15:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

9 5 1
W
.
.
S
S

output:

W
#
#
#
#


result:

ok 5 lines

Test #16:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

14 4 4
.S..
.W..
...S
....

output:

#.#S
#.#*
#S#.
###.


result:

ok 4 lines

Test #17:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

53 2 4
.S.S
....

output:

#.#.
#S#S


result:

ok 2 lines

Test #18:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

97 1 2
W.

output:

*#


result:

ok single line: '*#'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

80 4 3
...
...
...
.S.

output:

###
#.#
#.#
#S#


result:

ok 4 lines

Test #20:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

86 5 2
..
..
..
..
..

output:

##
##
##
##
##


result:

ok 5 lines

Test #21:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

34 2 5
.S...
.....

output:

#S###
#.###


result:

ok 2 lines

Test #22:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

62 3 3
...
...
S..

output:

###
S##
.##


result:

ok 3 lines

Test #23:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

53 4 4
....
....
....
...W

output:

####
####
####
#*##


result:

ok 4 lines

Test #24:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

54 5 5
.S...
.....
WW..W
...S.
...WW

output:

#####
#####
**#*#
#####
###**


result:

ok 5 lines

Test #25:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

46 1 1
.

output:

#


result:

ok single line: '#'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

12 8 15
W.S...W........
.....WS.....W..
..S.SW...S...S.
S....S.........
W......W.S.....
..........S.W..
.W.W..WW...WSW.
.WW......S.....

output:

#*########*#.##
*###*####W##.##
##W###*###*#S*#
###############
##*#*####*##*##
.#*######W#####
.*##*#*#**#*#*#
S####*###*##*W#


result:

ok 8 lines

Test #27:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

6 9 15
.....W...S.....
S.....SS...W...
....W..S.......
......WW.S.....
..W..W...W...WW
S.W....W......W
.............WW
.....S.........
W...S..........

output:

###########W###
##W############
#####.####W####
####..#*#*##WW#
W###WW##W##W###
.####W*.W*###W#
*###WW#.#######
S######S#######
######W########


result:

ok 9 lines

Test #28:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

14 7 15
.W.....S....S.S
...........S...
W.S..........W.
.W..SSW........
..W..W..W....S.
.W.S.....W.....
....S.S..SS....

output:

W##*#*###*#####
###############
####*##*##*#W.#
##*##*####*#*.#
*###.#.*###**S#
####.#.#W##*##*
####S#S########


result:

ok 7 lines

Test #29:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

4 5 7
.WS....
.......
.......
W.S....
......W

output:

#####W#
#######
##S####
####W##
##SW###


result:

ok 5 lines

Test #30:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

15 7 13
...W...W.S.WS
......S...S..
.......W.....
.W........WW.
.W..S....W...
..WWW....WW..
...S.........

output:

*###*###*###.
############S
######*##*###
###W###**#*##
######*####*#
#*#**#*#####W
############.


result:

ok 7 lines

Test #31:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

2 6 8
.......W
..W....S
..S...W.
S.....S.
.W.....W
.SS..W..

output:

.W......
.SS.W...
W......*
........
*WSW....
......SW


result:

ok 6 lines

Test #32:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

15 8 14
............S.
S...W...W.....
...W.S....S...
...W...W......
..S......W....
.......S.....W
S..S...W......
..............

output:

S#############
*#.#*#########
##.##########*
##S*#########*
###.#*####W###
W##S###*##*#*#
.##*##########
.#############


result:

ok 8 lines

Test #33:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

9 10 3
..W
WSS
W..
...
...
S.W
...
S..
...
...

output:

##W
W##
W*#
###
.##
.#W
S##
###
##.
##.


result:

ok 10 lines

Test #34:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

2 10 1
.
S
.
.
.
.
W
.
.
.

output:

.
.
.
S
.
.
W
.
.
.


result:

ok 10 lines

Test #35:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

10 1 6
SW...W

output:

*##W#*


result:

ok single line: '*##W#*'

Test #36:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

78 17 20
..SWS.......S.....W.
.............W....W.
WS...S..W....S...W..
.W...W...........S..
......SS.....S...W..
....S.........S....W
..S..........S......
..W...S.....S...WW.W
.....S.W.....S......
....W..WS......S.S.W
..SW.WS.W.W.SS...W..
..W......W.W....SS..
..W.................
..S...S....W.....S...

output:

########*####*######
##*###*#########*###
##*#****####***#*###
###**########*#*####
#######*#########*##
#########*#######.##
#################S##
#*##*##*#***#####*##
##*#########**######
##*##**#####*###**##
###*#*##*####*#*#**#
##*#########*######*
######.#####*#######
#####*.########*####
######...

result:

ok 17 lines

Test #37:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

79 5 8
..W.....
.SSW....
SS......
........
...SW.S.

output:

#*S*#*##
#S###*##
########
##.#####
*.*###*#


result:

ok 5 lines

Test #38:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

48 6 6
.W...S
......
..WW..
......
W.....
..W...

output:

#####*
######
*##*#*
######
####*#
*#####


result:

ok 6 lines

Test #39:

score: 0
Accepted
time: 1ms
memory: 3524kb

input:

77 10 20
.W.......S.S.....S..
...W..........S....W
....................
.S....SS.S..S.W...W.
....S.S........S....
......S...WW.....WS.
........S....SS.W.SS
W.W....WS..W..S.W...
..W.................
........W...W..S....

output:

#*##.#*##S#*########
####S####*###*######
####################
#######**########*##
####################
#*#####**###*#*###**
######*#############
#*###**#****#*#*##*#
####*#**#.####*#####
####*####.####*###*#


result:

ok 10 lines

Test #40:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

56 8 6
......
....W.
.W...S
.....W
....S.
...S.W
......
...W..

output:

######
###*#*
####.*
###*.#
###.S#
###S##
######
#*####


result:

ok 8 lines

Test #41:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

63 17 4
W...
....
...S
.W..
....
....
.S..
...W
....
W...
..SS
....
...S
..S.
.W..
..WW
W...

output:

##*#
####
####
###*
####
####
####
#*##
####
#*#*
####
####
####
####
#***
#*#*
*#*#


result:

ok 17 lines

Test #42:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

99 3 4
....
WWW.
.W..

output:

####
*#**
###*


result:

ok 3 lines

Test #43:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

47 13 15
.....WWS.......
.......W.......
W..............
.W......W......
.S...S.W....S..
.W....W........
.W............W
.........W.....
......WW.......
.....S....S.S..
.W.........SS..
S...W.S....WW..
S...W..........

output:

*####*####*####
#######*###**##
##########*####
#*#*##*########
##*############
#*#########*###
#**####*###*###
*####*######*##
*#*#######*####
###############
#####.#####*###
#####.#*####*#*
#####S########*


result:

ok 13 lines

Test #44:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

53 12 3
S..
...
S..
...
...
...
W..
...
...
...
W.S
..W

output:

###
###
###
###
###
.##
*#*
S##
###
###
#*#
*##


result:

ok 12 lines

Test #45:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2 17 12
...........S
...S........
..W.......S.
...S..SW....
.S.W......W.
...W......W.
.....W....S.
.W.S.W...W..
.......W...W
.S.........S
.S....WS...W
S..W....S.S.
...WWW.....S
......W..S..
WS.SS.SS....
W......S....
.....W......

output:

.......S....
............
...*W......S
.........W..
W....W....S.
W..S.WS.....
.S.....W....
...W...W..*W
.W.......W..
...S........
.W......W...
.S...W.....S
.S...WWW....
S.......W.S.
..W........S
.*W......S..
...SS.SW....


result:

ok 17 lines

Test #46:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

100 20 20
.........W..S.......
....W...S.S..WW.....
....SS......S......W
...............SW..W
........S...........
..........W....W.W..
.....W......W.......
........W...W.......
..W....S.......W.W.W
........SS...S..S...
...SW..S.W.W.....S..
.S.............W....
...W...S............
...........S........

output:

*#########*#########
#####*###*####**###*
#########*##########
###****######*######
####################
**#*###*#####*######
#####*####*####*####
##*#############.#*#
###.#*#*####*##*.###
###.############S###
#**S########*######*
####*######.##*#####
#######**##.#####*#.
###########S#######.
####*#...

result:

ok 20 lines

Test #47:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

100 20 20
...WSWWS....S.......
....S......S..W...S.
.W.....S.....SS.S..S
..W........W....W...
.S..SS.....W.W.S...S
S..S..WW.W.W....S..S
......W...S...S.S..W
.....S......S.....S.
..SS.......S........
..WW.WW....S........
.....S..SS.W.W..WS..
.S.S...........SW..W
..W.......WWS.......
W...........SW......

output:

*###S##.*#*#**####*#
#####*#.#######*#*##
#####.#S###*########
#*##**###*##*#**##*.
##**#S####.#**.####.
##*####*##.**#*#**#S
**########S*##S#*###
###########.########
###########.########
###*#*#####S#*#**###
######**#*##.###*##*
##*####*####*####*##
#*#*##*#####S*##*###
#####*####*####*####
######...

result:

ok 20 lines

Test #48:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

100 20 20
.SW........S.....W..
...S......S.........
................WW.S
S.......S.WW....SW..
.S.S............W...
...WW......WS.......
..W........S.....S.S
S.....S.............
............W....W..
...W........S...WSS.
.....WS.............
...W.....W...S...WW.
W...S..SSW.S.W....W.
...W............W...

output:

#######*##.S*#######
########.#S#########
###.##**.###########
*##.###*S########**#
###S##*#############
.*#######*#*##*#####
.###########*#######
S################..#
#**########*#####..*
######*######*###SS#
########.####.#*####
#######**####S#####*
#*#*####S#***######*
####*#*##*######*###
##*###...

result:

ok 20 lines

Test #49:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

100 20 20
................S...
S.S.....WW.....W.W..
...S.S..............
.W.................W
..S......S.W......SW
..W.W.WS...........S
......S..W.......WSS
...S...W...........W
..S.........S.....S.
.S.......WW..S...SWS
.WW..........WSW....
.S.WS......WS..SS..S
..S.......S....W....
.......W....WS......

output:

.###################
S*#####*###*####***#
#########.##########
*###*####.**#######.
#**######S##*######.
#####*########***##S
#######*###########*
##*#####*####*#*#**.
##############.####.
*#######*#####.####S
###*##**###*#*S##*#*
########*####*####*#
######*#######.#*###
##*#########*#.#####
#*####...

result:

ok 20 lines

Test #50:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

100 20 20
S..W..S.....WWWW.S..
...............S....
.S............W..S..
....W.....S...W.W...
SW.................W
.......W.W..W..SW...
W....SW..S..S..S...S
.....W..S...........
W.............S..W..
....SW..W.......S...
W.S.....S.W.......W.
.........WS.........
...........W....S...
.SS.......S.........

output:

##***####*###*###*#*
####################
.######*#######*#*##
.##*###**####*###*##
S*###.#####*########
##*##*####*####*#*#*
#####S*#######.#*###
##############.*####
#########**###S####*
###############*##*#
*#######*#*####*.###
################.##*
#*##############S.##
##*#########*####.##
######...

result:

ok 20 lines

Test #51:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

100 20 20
.W.....W............
...S..SW..S..SW.....
....................
......S........S...S
.WW....W..SS..S..S..
.W.....W...........W
.S.S.S.........W...W
....S.S....S......S.
W........SW..S...W..
....S........W..SW..
...WS...WS..........
WW.W..S.S.WWSW...W..
..S.S......W........
W..S.....W...W......

output:

###*#########*###*##
######.#*########**#
######.####.########
######S####.########
*.#.##*#***S*###*###
#.#*###*###*#####*##
#S#S###*#*#######*##
####*###############
#####*##*.**##**##*#
######.*.*#########*
####***#.S#####*##*#
#*****S*S#****#*####
##*.S#######*#######
###S######*########*
*#####...

result:

ok 20 lines

Test #52:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

100 20 20
..S..S.W............
....W.W...........S.
....S......W..WW..W.
..W...W.........S...
.....S.S...W.....W.S
......S....W........
W.W.........W.......
....S.S.....W.......
..............S..W..
...........SWS.....W
W.S..WS.....W....S..
..W.W...............
....S.........S...S.
WS...S.S.W.W........

output:

*#########*#########
*####*####*#####*###
#*##***#*#######**#.
#####.######*###*##.
#*###S#*###########S
#*##################
##*#*#######*#*#####
########*#######*#*#
#######*############
##*######*##########
##**######*##***##.#
#.####*#######*#*#.#
#.################S#
#S########*########*
######...

result:

ok 20 lines

Test #53:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

100 20 20
........S...WS......
..WS..W.S..WS...S...
.......W............
.........WW.....S...
..........W.....W...
.....S........W.....
..S..W...S......S...
..S.....S..S.W...S..
S...W.......S.SW....
.....W......WWW.....
......W.....WW.....S
.S.....S..W...S.W...
.S.........W........
....................

output:

#*#.####S##*####.##*
#*#S########*###S###
*#######*#*#########
#*###.#####***#####*
##*##.**####*####*##
#####S*####.####*.##
.#*########.*####.##
.##*#######S#####S##
S####*########*#####
##*#*#*.######***###
##**###.######.#*###
*#####*S######S#####
#*######.###########
###.####.###########
###.##...

result:

ok 20 lines

Test #54:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

100 20 20
.S.S......W........W
..W........W........
.....W......S.......
..............S.....
.............S......
....W.........W.....
.W....SSW...S.S..SS.
.......S.SW..SWS..S.
.........W..S....W.S
......W...S...W.....
...W..W......S.S....
......S.....S..W...W
S.......S....S..S...
.SS..W.W.S.S........

output:

**########**########
*##*##*######*##*###
#########*##**#####*
####################
####################
####**########**####
######*####**###*###
#*####*####*#**#*###
########*######.##**
#######*#######.**##
#######*#*#####S#*#*
#####*###*##########
#########.##########
##*#####*S##***#####
###*##...

result:

ok 20 lines

Test #55:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

100 20 20
..................S.
............S.WW...W
S..SWS.....SWSW...S.
....W...............
............S..S....
.SWW........S..S...W
S...S...SSW.........
S......S....W..WW...
.W.W.W.........W.S..
....WSW...W....W....
W.S....W...WW.......
.....S..W.....WS....
S...S....W.......W.W
..........W.W..W....

output:

####################
*###**###*#####*####
##*#*#########*#####
#####*#########*####
####################
####*####*##*#*#####
##*#########*#######
*####**#######***###
##*#**#####**#*#####
*#.*#*###*###**#####
.*S#*#######*#*###*#
.##*#########*###**#
S######*#*########.*
*#*##*############.#
*#####...

result:

ok 20 lines

Test #56:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

100 20 20
SSSWWSSSSWWWSWSWWWSS
WWSWWWWSWWSSWSWSSWSS
SSWSWWWSSWSWWSWSSSSW
WSWSSSSSWWWWWSSSSWSS
WWSSWWSWWSWWSSWSWSSS
WWSSSSSSWSSSWSSWWSSW
SWSSSWSWWWWSSWSSWSSW
WWWSWSWWSSSWWSWWWSSW
WSWWWSSWSSSWWWSWWWSS
WSWWSSSWSWSWWSWSSWWS
WWSWWSSSWSSWSWSSSSWS
WSSSSWWSSSSWSSSWSSWS
SSWSWWSWWSSWSSWSWSSW
WSSWWWSWWWWSWSSWW...

output:

**#*#***##*##*##*###
#**#******#***#*#***
**###*#****#****##*#
****######****####**
**###***###*###****#
##**#**#***##*******
*****#*##***********
*#****###**#********
#*#******#*##**##**#
***#*###******####**
#*#****##*#*###**#**
#*##*#*********#*##*
*#***##****#****#*##
***##***#**#********
#*#*##...

result:

ok 20 lines

Test #57:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

100 20 20
WWSWWSWSWWWSWWWSWSWS
WWWSSSWWWSSSWSSSSWWS
SSSWWWSWSWWWSSSWWWSS
WSWWSWWWSSWSWWSSSSWS
WSSWWSSSWWSSWWWSSWWS
WSWSWWWWWSSSWSWSSSSW
WSWSSWSSSWWWWSSSWWSS
WSSSSWSSWSWSWSWWWWWW
WSWSSWWWSWWWWWSWWSWS
WSWSSSWSWSWSWSWWWSWW
WSWSSWWWWSWSSSSSSWSS
SSSWSWSSWWWSSSSSWWWW
WSWWWSSWWSWWSSSWWWWW
SSWSWSSSWWWWSWSWW...

output:

#*#*#****##*********
***####*##***####***
#*##****##**###***##
**###**#**#******##*
******#*#**##***###*
#**##*****#**##****#
#***###*#*****#*#***
**#*#**#**#*#*#**#**
#*#***************#*
******#*#*###**#****
#*#**##***#*##**#*#*
#*##***#**#*###*##**
**#******##****##**#
*###****#*##******#*
******...

result:

ok 20 lines

Test #58:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

100 20 20
WWWWSWWSSWSSWWWSWWSS
SWSWWWWSWWWSSWSWSWWS
SWSSSWSSSSSSWWWSSWSW
SSSSWSWWWWWSSWSWSSWS
WWSSSWWSSWSSWSWSSSWW
WSWSWWWWSSWWWWWSWSSW
SSSWSWSSWWSWSWWWWSWW
SSSWSWWWSSSSSSWWWWWW
WWSWWWSSWWWWSWSSSSWS
SWSSSSWWWWSSSSWWWSWS
WSWWWSWSSSSSSWSSWSWS
WSWWSSWSSSSSWSWSSWSS
WWSWSSWWSWWWWSWWWSWW
SSWWSWSSSSSWWSWWS...

output:

##*#***##**#*****#**
******#*#****#**#***
*#*#*#**##*#*#***###
#***##*******#*#****
*****#####*#**#**##*
#***##*************#
#*#*#*#*****#*#*****
*********#####*#***#
*************#**##*#
***##****##**##*****
###*****#**##**#**#*
#**##*#*####**#*#*##
***#****************
#*#***###*##**#*####
*****#...

result:

ok 20 lines

Test #59:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

100 20 20
SSWWWSSWWSWWWWSWSWSW
WWSWWWSWSSWSSWWSWWWS
WSSWWSSWSSWWSWSWSSWW
WSWWWWWSSSWSSWWSWWWW
WSSWSSWSWSWSSWWSSWSS
WWSSSWSSSWWSSSWSSSSW
SSWWWWWWSWWWWSWWWWWS
WWSWWWWWSWWSWSWSWSWW
SWWWWSSSSSSWWSSSSWWS
SSSSWSSSSSSSWWWSWSSW
SWSWWSWWWSWSWSSSSSSS
SSWWWSWWSSSSWWWSWSSW
WWWSWWSWWSSSWWWSWWWS
WSSSWSSSSSWWSSWWW...

output:

*#****#****#***###*#
***#***#*##****#***#
****#*##********###*
***#******##******##
#***##****#***#**##*
#**##*###*#**##*###*
##********#*********
*****#*#*********#**
#***###**###***#####
*##*#**###*##***####
#**##*********##*#**
**#*#*****#*********
****#*#*******#*****
**###***#***##**###*
****##...

result:

ok 20 lines

Test #60:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

100 20 20
SWWWSSSSWWSWSSWSSWWS
SWSSWSSSSWSSSWSSSSWW
SWSSSWSSWWSWWSSSWSSW
WSSWSSSSSWWSSSWSWWSS
WWSSWSSSSSSWWSSWSSWS
WSWSSSSSWWSSSSSWSSSS
WSWSSSWSSSSSSWSWWSWW
WWWWSSWSSWWWWSWWSSWW
SWWWWWSSWWWWSWSSWWWW
SSWWSSSWWWSWWWSSSSSW
WSSSWWSSSWWWWSSSWWWS
SWWWSSWSSSWSSSSWWSWW
SSSWWWWSSSSSWWSWWWWS
WWSWWSSSSWWSSSSWW...

output:

*#**###*******#***#*
*##*#*###*****#*###*
*#*###***#*#*******#
*###*****#*********#
*********#*#********
#*#**#*##***##*#*##*
#****##***##***#****
#***************#**#
**#*******#**##*#***
*#*#*#####*#***##***
***##*******#####**#
*#******#**#***##*#*
####*****####******#
***##***#***********
##*#*#...

result:

ok 20 lines

Test #61:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

100 20 20
................W...
..................W.
...S....WS..........
...W................
.........W..........
....................
....................
....................
..............S.....
....................
....................
.....W..............
.........S...W......
........W...........

output:

######*##.##########
########*.##########
#########S########*#
#############*######
###################*
####################
##############.#####
##############.#####
##############S#####
####################
####################
###############*####
###*#########*######
#########*#########*
######...

result:

ok 20 lines

Test #62:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

100 20 20
....................
....................
.S..................
....................
....................
W......SW...........
....................
....................
........S...........
....................
....................
....................
....................
...W................

output:

#.##################
#.##################
#S##################
#######.############
#######.############
#######S##*#######*#
#####*##############
####################
####################
####################
####################
####################
#.##################
#.#.####*#########*#
#S#.##...

result:

ok 20 lines

Test #63:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

100 20 20
....................
.S..................
......W.............
....................
W...................
....................
..W.................
.W..................
........W...........
....................
....................
....................
....................
.....W..............

output:

#.##################
#S##################
################*###
####################
##########*#########
####################
############*#######
###########*########
##################*#
####################
####################
####################
####################
###############*####
######...

result:

ok 20 lines

Test #64:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

100 20 20
....................
....................
....................
........W...........
....................
....................
....................
...........S........
....................
W...................
....................
....................
....................
....................

output:

####################
####################
####################
##################*#
####################
###########.########
###########.########
###########S########
####################
##########*#########
####################
####################
####################
####################
##*###...

result:

ok 20 lines

Test #65:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

100 20 20
..........S.........
....S...............
....................
....................
....................
....................
.......W............
....................
..W.................
....................
....................
.W..................
.....S..............
....................

output:

####.###############
####S###############
####################
####################
####################
####################
#################*##
####################
*#########*#########
####################
#####.##############
#####.#####*########
#####S##############
####################
######...

result:

ok 20 lines