QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#71502#2662. Bombermanpibuxd100 ✓217ms57108kbC++144.6kb2023-01-10 23:26:552023-01-10 23:26:56

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-10 23:26:56]
  • 评测
  • 测评结果:100
  • 用时:217ms
  • 内存:57108kb
  • [2023-01-10 23:26:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(x) x.begin(), x.end()

int n, INF = 1e8;
array<int, 2> P, K;
vector<vector<char>> a;
vector<vector<int>> dp, dk; // dist od (p,k)
vector<vector<vector<int>>> DPP, DPK; // dp od (p,k)

bool e(int i, int j, const vector<vector<int>> &d, const vector<vector<char>> &A){ // ok
  return (1 <= i && i <= n && 1 <= j && j <= n && d[i][j] == INF && A[i][j] != 'X' && A[i][j] != '#');
}

void bfsd(array<int, 2> &start, vector<vector<int>> &d, vector<vector<char>> &A){ // ok
  queue<array<int, 2>> Q;
  Q.push(start);
  d[start[0]][start[1]] = 0;

  while(!Q.empty()){
    auto v = Q.front();
    Q.pop();

    if(e(v[0]+1, v[1], d, A)){
      Q.push({v[0]+1, v[1]});
      d[v[0]+1][v[1]] = d[v[0]][v[1]] + 1;
    }
    if(e(v[0], v[1]+1, d, A)){
      Q.push({v[0], v[1]+1});
      d[v[0]][v[1]+1] = d[v[0]][v[1]] + 1;
    }
    if(e(v[0]-1, v[1], d, A)){
      Q.push({v[0]-1, v[1]});
      d[v[0]-1][v[1]] = d[v[0]][v[1]] + 1;
    }
    if(e(v[0], v[1]-1, d, A)){
      Q.push({v[0], v[1]-1});
      d[v[0]][v[1]-1] = d[v[0]][v[1]] + 1;
    }
  }
}

bool e2(int i, int j, const vector<vector<char>> &A){ // ok
  return (1 <= i && i <= n && 1 <= j && j <= n && A[i][j] != 'X');
}

bool e3(int I, int J, int i, int j, const vector<vector<int>> &DS){ // ok
  return (1 <= i && i <= n && 1 <= j && j <= n && 
          1 <= I && I <= n && 1 <= J && J <= n &&
          DS[I][J] == DS[i][j] + 1);
}

char ju(array<int, 2> &PK, const vector<vector<int>> &DS){ // ok
  if(e3(PK[0], PK[1], PK[0]-1, PK[1], DS)){ // G (D)
    PK[0]--;
    return 'D';
  }
  if(e3(PK[0], PK[1], PK[0]+1, PK[1], DS)){ // D (G)
    PK[0]++;
    return 'G';
  }
  if(e3(PK[0], PK[1], PK[0], PK[1]-1, DS)){ // L (P)
    PK[1]--;
    return 'P';
  }
  if(e3(PK[0], PK[1], PK[0], PK[1]+1, DS)){ // P (L)
    PK[1]++;
    return 'L';
  }
  return 'X';
}

vector<char> droga(array<int, 2> &B){ // ok
  vector<vector<char>> A = a;
  int o = B[1];
  while(e2(B[0], o, a)){
    A[B[0]][o] = '.';
    o--;
  }
  o = B[1];
  while(e2(B[0], o, a)){
    A[B[0]][o] = '.';
    o++;
  }
  o = B[0];
  while(e2(o, B[1], a)){
    A[o][B[1]] = '.';
    o--;
  }
  o = B[0];
  while(e2(o, B[1], a)){
    A[o][B[1]] = '.';
    o++;
  }
  vector<vector<int>> DS(n+2, vector<int>(n+2, INF));
  bfsd(P, DS, A);
  //cout << DS[K[0]][K[1]] << "\n";

  vector<char> dro;
  array<int, 2> PK = K;
  while(PK[0] != P[0] || PK[1] != P[1])
    dro.push_back(ju(PK, DS));
  reverse(all(dro));
  return dro;
}

int check(array<int, 2> B){
  return (min({
      DPP[1][B[0]][B[1]],
      DPP[2][B[0]][B[1]],
      DPP[3][B[0]][B[1]],
      DPP[4][B[0]][B[1]] 
  }) + min({
      DPK[1][B[0]][B[1]],
      DPK[2][B[0]][B[1]],
      DPK[3][B[0]][B[1]],
      DPK[4][B[0]][B[1]]
  }));
}

void preDP(vector<vector<vector<int>>> &DP, vector<vector<int>> &d){
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){ // L
      if(a[i][j] == 'X') DP[1][i][j] = INF;
      else DP[1][i][j] = min({d[i][j]-1, DP[1][i][j-1], d[i-1][j], d[i+1][j], d[i][j-1], d[i][j+1]}) + 1;
    }
  }
  for(int i = 1; i <= n; i++){
    for(int j = n; j >= 1; j--){ // P
      if(a[i][j] == 'X') DP[2][i][j] = INF;
      else DP[2][i][j] = min({d[i][j]-1, DP[2][i][j+1], d[i-1][j], d[i+1][j], d[i][j-1], d[i][j+1]}) + 1;
    }
  }
  for(int j = 1; j <= n; j++){
    for(int i = 1; i <= n; i++){ // G
      if(a[i][j] == 'X') DP[3][i][j] = INF;
      else DP[3][i][j] = min({d[i][j]-1, DP[3][i-1][j], d[i-1][j], d[i+1][j], d[i][j-1], d[i][j+1]}) + 1;
    }
  }
  for(int j = 1; j <= n; j++){
    for(int i = n; i >= 1; i--){ // D
      if(a[i][j] == 'X') DP[4][i][j] = INF;
      else DP[4][i][j] = min({d[i][j]-1, DP[4][i+1][j], d[i-1][j], d[i+1][j], d[i][j-1], d[i][j+1]}) + 1;
    }
  }
}

int main(){
  fastio;
  cin >> n;

  a.resize(n+1, vector<char>(n+1));
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      cin >> a[i][j];
      if(a[i][j] == 'P') P = {i, j};
      else if(a[i][j] == 'K') K = {i, j};
    }
  }

  dp = dk = vector<vector<int>>(n+2, vector<int>(n+2, INF));
  bfsd(P, dp, a);
  bfsd(K, dk, a);

  DPP = DPK = vector<vector<vector<int>>>(5, vector<vector<int>>(n+2, vector<int>(n+2, INF)));
  preDP(DPP, dp);
  preDP(DPK, dk);

  int ilr = INF;
  array<int, 2> B;

  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++)
      if(a[i][j] != 'X'){
        int r = check({i, j});
        if(r < ilr)
          ilr = r, B = {i, j};
      }

  if(ilr == INF){
    cout << "NIE\n";
    return 0;
  }
  cout << ilr << "\n" << B[0] << " " << B[1] << "\n";
  vector<char> dro = droga(B);
  for(char x : dro) cout << x;
  cout << "\n";
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

5
P..X.
X....
..X..
....X
.X..K

output:

8
1 1
PPDPDDDP

result:

ok 

Test #2:

score: 0
Accepted
time: 2ms
memory: 3452kb

input:

5
....P
.XXXX
.....
XXXX.
K....

output:

16
1 1
LLLLDDPPPPDDLLLL

result:

ok 

Test #3:

score: 0
Accepted
time: 2ms
memory: 3460kb

input:

2
PX
.K

output:

2
1 1
DP

result:

ok 

Test #4:

score: 0
Accepted
time: 2ms
memory: 3468kb

input:

2
P.
K.

output:

1
1 1
D

result:

ok 

Test #5:

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

input:

2
P.
.K

output:

2
1 1
PD

result:

ok 

Test #6:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

2
PX
XK

output:

NIE

result:

ok NIE

Test #7:

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

input:

3
P.X
...
X.K

output:

4
1 1
PDPD

result:

ok 

Test #8:

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

input:

10
XXXX...X..
X.KX.X....
X.....XX..
X.XXX..X..
X.X...X.X.
X....X..X.
XXXX..X...
......X.XX
.XXXXXP...
........X.

output:

21
1 5
PGGPPGGGLGGLLGLLDDLLG

result:

ok 

Test #9:

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

input:

10
......X...
.PX...X...
.XX.....X.
....X...X.
.XXXX..X..
X.....XX.X
..........
.X.....XX.
.......XK.
..........

output:

18
1 2
GPPPPDDDDDDPDDDPPG

result:

ok 

Test #10:

score: 0
Accepted
time: 2ms
memory: 3448kb

input:

9
....X....
...X..X..
..X..X..X
.X..X..X.
X..X..X..
..X..X...
.XP.X..X.
..XX..XK.
.....X...

output:

40
1 6
PGPGPGPGPGGLLDLDLDLDLDLDDPDPPPGPGPGPPDDL

result:

ok 

Test #11:

score: 0
Accepted
time: 205ms
memory: 56584kb

input:

1000
.......X...X.....X..........X.X...XX......XXX...XX.............X...X.................X.X......X....XX..XX...........X...XX..XXXXX.XXXX....X.XXXX.....X...X...X......X.......X..XX........X....XX...X.....X.XX.X.XX.X...X.........X.X...X...............X.....XX..X...X.......X.XXXX....X.XX.X......X......

output:

1097
365 681
LLDLLLLLLLLLLLLDDDLLLLDDLLDLLLLLDLDLLDLDLLLLLLLLLDLLLLLDLLLLDDLLDLLLLLLLLLLDDLLDLLDDDLDDDLLDDDDLLDDDLLLLLLDLLLLDLLLDLDDDLDDDLLLLLLLDDLLLLDLLDDDLDDLLLLLLLLLLLLLLLLLLLLDLLLLDLDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDLLLLLLLLDLLLLLLLLLLDDLDLLLDDLLLLDDLDDLLLLLLLLLLLLLLLLLDLDDLLLLLLLDDDLDLDLL...

result:

ok 

Test #12:

score: 0
Accepted
time: 207ms
memory: 56660kb

input:

1000
...X..XX.X..X.......XXX...X........XX.XX....XX..X...............XX...XXX..XX.X.......X...X.X.X...X..X.....X....X.X..XX.X..XXX...X........XX...XX....X..X..X...X..X...........XX......XX.X.....XX...X...XX..X..XXXX..X...X.XX....XX.X.XX.......X..XXX................X.....X.XX.........X..X...X.X.........

output:

626
286 783
LLLLLLLGGGLLLDDLDDDLLLLDDLLLDDDLLLLLLLLDLLDDDDDDDDDLDLDDDDDDDLLLDDDLLLDLDDDDDDLLDDDDDDLLLLDLDLLDDDLDDDDLDDDDDLDLLLDDDDLDLLLDLLDLDLDDLDDDLDDDLDDDDDDDLDDLLDLDLLLLLLLDDLLLDDLDDLLDDDLLDDDDDDLDLDDDDDDDDDDLDLDDLLLDDDPDDDDLLDDDDDLLLDDLDDLLLLLLLLDDDLDLLLDLLLLGLLLLLLLLDLLLLLLLLLLLLDLDLLDLLLDDDDLD...

result:

ok 

Test #13:

score: 0
Accepted
time: 209ms
memory: 56824kb

input:

1000
.X..X..X...XX....X....X....X.XX....X....XX..........X...X..X.X.XX.X...XX...X.XX..X...X.X....XXX.X.XXX.....X.X.....X.......XX..X.XX.XX...X...X...XXXXXX...XXX..X...X.X...X.X.....X...X.......XX..X..XXX.XX...XX......X.XX.XX.....X...X...X.X......X..X.....X.X..XX.X....X..X.X..X..X..X.XX.X.XX...X....X...

output:

1053
529 415
LLDDDDDDLDDDPPPDDPDPPPPPDDDPPDDDDDDDDDDPPPPPPPDDPDPDPPPPPPPPPPDPPPDPPPPDPDPPPPPPPPPPPPDPDPDPDPPGPGGPGPPDPPPDPPPPDDDDDLDDDDDPDDDDPDPDDLDDDPPDPDDDDDDDPDPDDDDDDPDPDPPDPPPDDLDDDDPDPDDDPPPGPPDDDDDDDDPDDDLDDLDDDDDDDDPPPDDDDDDLLDDDDDDPPPDDDDDPPPPDPPPPDDDDDPPPPPPPPPDPPPPPPPPPPPPPPPDDPPDDPPPPDPD...

result:

ok 

Test #14:

score: 0
Accepted
time: 151ms
memory: 55572kb

input:

1000
...XXX.XX...X......X...........XXXX.XXX..XXX...XX.XXX.XXX.X.......X..X...X.X...XX......X.X...X...XX..X.X.....XX..X.X.X.XXXX..X.X.X...X.X.......XX..X...X...XX.X.XX.X..X.X....X.X..X.X....X.X.....X....X.X.XX.XX.X..X...X..XX..X...XXX.X..X..X.XX.X.........XXX..XX.X..X..X..X.X.XX....X...XXX...X.X.X.X...

output:

NIE

result:

ok NIE

Test #15:

score: 0
Accepted
time: 138ms
memory: 55544kb

input:

1000
XX...X.XX.XX.X..X..X..X...X..X.X....X.X.....X.X....XXXXX.XXX...X....XX.X.X.XX.X....X..XX.X...X.....XX....XX....X.X....X..XXX.XXXXXX.X....X.X....X..X..XXX.X..X.XX.X..XX..XXXX.XX.....X..X.X..X.XXXX...X.XXX.....X..XXXX.X..XX..XX.......X..XX..XXXX.XXXX..X...XX..X....XX.X...X.X..X..X.X.XXX.XX...XXXX...

output:

NIE

result:

ok NIE

Test #16:

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

input:

7
P......
.......
.......
.......
.......
.......
......K

output:

12
1 1
PPPPPPDDDDDD

result:

ok 

Test #17:

score: 0
Accepted
time: 185ms
memory: 56268kb

input:

999
..X.XXXXX.X.XX.XX.X..XX..XXX..XX....XX...X.XXXXX..XXX..X.XX.XXX.X..X.XXXXX.X.XXXXXXXXXXXXXXX...XX.X..X...X.....X.XXXX.X..XXXX.XX.X.XXXXXXX..XXX.XXXX.X.XX.XX.X..X..XXXXX.X.XXXX..X.XXXX..X.XXX.XXXXX...XX....XXXXXXX.XXXXX....X.X.XXXXXX..XXX.XXXXX.XXXX.XXXXXXXXXXXXXXXX.X..X.XXXX.X.X..XXXX..XXXX..XXX...

output:

2179
2 6
DDDDDDLLLLLGGGGGGGGGGGGGGGLLDDDDDDLLGGGGGGGGGGGGGGGGGGLLLLLGGLLLLLLGGLLGGLLGGGPGGLLLLLLLLLGGLLLLLLLLLGGLLGGGLLLLGLLLGGGGGGGGGGLLLLLLGGLLLGGGLGGLLLLLGGLGGPGGPPGGGLLGGGGGGGGGGGLGGPGGPPGGGGGGGGGLLDLLDLLLLLLLGGPPGGGGGGGGGGGGGGGGGGGLGGLGGLGGPGGGGGGGGLLLGGGLLGGGLLLLLLLLLGGGGGGGGGGGGGGGGPGGPGGPGGL...

result:

ok 

Test #18:

score: 0
Accepted
time: 148ms
memory: 57108kb

input:

999
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

270890
39 698
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

result:

ok 

Test #19:

score: 0
Accepted
time: 143ms
memory: 56888kb

input:

999
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

253897
2 16
PGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGG...

result:

ok 

Test #20:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

2
KX
XP

output:

NIE

result:

ok NIE

Test #21:

score: 0
Accepted
time: 2ms
memory: 3468kb

input:

10
XX........
XXX.....K.
.XXX......
..XXX.....
...XXX....
....XXX...
.....XXX..
......XXX.
.P.....XXX
........XX

output:

NIE

result:

ok NIE

Test #22:

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

input:

2
PK
..

output:

1
1 1
P

result:

ok 

Test #23:

score: 0
Accepted
time: 7ms
memory: 5532kb

input:

200
....................X..........................................XX..........X.....................................................................X...................X..................................
..........................................X.......................................................

output:

167
38 39
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLGGGGGGGGGGGGGGG

result:

ok 

Test #24:

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

input:

21
XXXXXXXXXXXXXXXXXXXXX
X..................PX
X.XXXXXXXXXXXXXXXXXXX
X...................X
XXXXXXXXXXXXXXXXXXX.X
X...................X
X.XXXXXXXXXXXXXXXXXXX
X...................X
XXXXXXXXXXXXXXXXXXX.X
X...................X
X.XXXXXXXXXXXXXXXXXXX
X...................X
XXXXXXXXXXXXXXXXXXX.X
X.............

output:

198
2 2
LLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPP

result:

ok 

Test #25:

score: 0
Accepted
time: 6ms
memory: 5620kb

input:

199
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X..................................................................................................

output:

4281
108 189
PPPPPPPPPDDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

result:

ok 

Test #26:

score: 0
Accepted
time: 7ms
memory: 5716kb

input:

200
XXXXXXXXX..XXXXXXXX..XXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXX..XXXXXXXXXXXXX..XXXXXXXX..XXX..XXX..XXXXXXXXXXXXXXXXXX..XXX..XXXXXXXXXXXXXXXXXXX
X.............XX........XX........XX........XX........XX...XX...XX........XX......................

output:

8497
2 3
LGGGGGLLLLLLGGLLLLDDDDDPDDDDDPPPPPDPPPPPPPPGGGGGGGGGGGGGGGLLLLLLLLLLGLLLLLDLLLLDDDDLDDDDDDDDDDDDDDDPPPPPPPPPPPPPPPPPPPPPPDPPPGGGGGGGGGGGGGGPGGGGGLGGGGGGGLLLLLLLLLLLLLLLLLLLLDLLLLLLLLLDDDDLDDDDDPDDDDDLDDDDDPPDDDDDDDDDDDPPPPPPPPPPPPPPPPPPPPPPPPPGPPPPPDPPPPGGGGGGGGGLGGGGGGGGGGGGGGGPGGGGGLGGGLG...

result:

ok 

Test #27:

score: 0
Accepted
time: 159ms
memory: 56676kb

input:

1000
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

50730
3 302
LLLLLLLDDDDDDDDDDDDDDDDPPPPPPPPPPPPPPPPDDDDDDPPPPPPPPPPPPPPPPPPPPPPPPPGGGGPPPPPPPGGGGGPPPPPPPPPGGGGGGGGGGGGGGGGGGGGGGGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGGGGGGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDDDDDDDDDDDLDDDDDDDDDDDDDDDDDDDDDDDDDPPPPPPPPPPDDDDDDDDDDDDDDDDDDDDDDDDDP...

result:

ok 

Subtask #2:

score: 20
Accepted

Test #28:

score: 20
Accepted
time: 0ms
memory: 3384kb

input:

10
..........
.########.
.#......#.
.#X##X#.#.
.#X#P.#X#.
.#X#..#X#.
.#X####X#.
.#XXXXX.#.
.#X####X#.
..X..K....

output:

16
4 7
PPGPPPDDDDDDLLLL

result:

ok 

Test #29:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

2
PK
X#

output:

1
1 1
P

result:

ok 

Test #30:

score: 0
Accepted
time: 2ms
memory: 3452kb

input:

2
#K
P#

output:

2
1 1
GP

result:

ok 

Test #31:

score: 0
Accepted
time: 2ms
memory: 3568kb

input:

50
..................................................
.#..............................................X.
..############################################..X.
#.............................................##X.
.############################################...X.
.............................................

output:

285
22 5
GGGGGGGGGGGGGGGGGGGGGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDPDPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPDPPDDLLLGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDDDDDDDDPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPDDDDDDDDDLLLLLLLLLGGLLLLLLLLLLLLLLLLLLLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDD

result:

ok 

Test #32:

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

input:

50
K......#####X#####################################
###..#.....#X#####################################
......####.#X#####################################
...###.###.#X#####################################
......#.....X#####################################
#####.#..###X#########.................###...

output:

64
11 27
DDDDPPGGGGGGGGGGGGGGGGGGLLLLLLLLLLGGLLLLLGLGLLGGPPGGGLLLLGLLLLLL

result:

ok 

Test #33:

score: 0
Accepted
time: 2ms
memory: 3452kb

input:

10
P########X
##########
##########
##########
##########
##########
##########
##########
##########
X########K

output:

18
1 9
PPPPPPPPDDDDDDDDDP

result:

ok 

Test #34:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

11
K..........
XXXXXXXXXX.
#..........
.XXXXXXXXXX
#.........#
XXXXXXXXXX.
...........
.XXXXXXXXXX
...........
XXXXXXXXXX.
P..........

output:

70
5 1
PPPPPPPPPPGGLLLLLLLLLLGGPPPPPPPPPPGGLLLLLLLLLLGGPPPPPPPPPPGGLLLLLLLLLL

result:

ok 

Test #35:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

5
##..#
.PX#.
.XXX.
#.XK#
.#.#.

output:

8
1 5
GPPPDDDL

result:

ok 

Test #36:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

7
.......
.......
###X###
#PX.XK#
###X###
.......
.......

output:

NIE

result:

ok NIE

Test #37:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

45
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX#
X.#...X..........XX.......XX#X#....XX.......X
#.#.X.#...X...###XX......#XX....#..XX..#..##.
..#.#.#..........XX.......XX.......X#........
..#.#.#...#.#X###XX.........#....#XX#........
X.#.#.#..........XX..............#.XX.......X
X.#.#.#.XX.######X#.....

output:

232
6 4
LLDDDDDDDDDDLDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLGLLGGGPGGGGGPGGGGPPGGGGGGGLLGGGLLGGLGGPPPPPPGGLLLLLLGGPGGGLLLLLDDDDDDDDDDLDDDDDDDDLDDDDDDDLDDDDDLLLLDLLLLLGLLGGGGGPGGGGPGGGGGGGGGGGGGGGGGGGGGLLGGLLLLLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

result:

ok 

Test #38:

score: 0
Accepted
time: 2ms
memory: 3536kb

input:

45
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X...X...XXX..XXX.XX.X.X#.#XX.X#.XX....#.X.XXX
XX.X......#.#X.#X..X...X..XX.........X...X.XX
X......#..X....XX...X#..X.XX..#.X..........XX
XXX..#....##...X...X.XXXXXXX.X..XX.XX...#..XX
X..XX...XX.XX..X.XX#..X...XX.#.X...XX....#.XX
XXX.#XXXXXX...#X.XX#....

output:

NIE

result:

ok NIE

Test #39:

score: 0
Accepted
time: 2ms
memory: 3644kb

input:

45
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X...#........##.#.....#...XX.......XX...#...X
X.X.........#.................X...........#.X
X....XX...#...........#X....#.#.X........X..X
X.#..X.X...........##.X.#...X..#.X...##.....X
X.#..........#..#.........................#.X
X...............#...#...

output:

NIE

result:

ok NIE

Test #40:

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

input:

45
.##X#X.#.XXXXX.X.#.XXXX#.X#.#.XX...X#..X#X#..
X.......XX.......XX............#..#..#..#...X
X...#........#...XX.....#....#.........#..#.X
X.............................#..#.......#..X
X..#..K.....#..........#....#.....#..#.....#X
X.........................XX.#..#..XX..#....X
X.#........#............

output:

215
5 7
LLGLLDLLLLLGLLLDDLLLLLDLLGLLLLLLLLGLLGLLGLLLLGGGGGGGPPPPPPPPPPPPDPPPGGPGGPPPPPGPPDPPPPPPGGGGLLLLLLLLGLLLLLGLLLLGLLGLGLLLLGLLDLLLLLLLGGGGGPGPPPPPPPPGPPPPPPPPPPGPPPPPPPDPPPGGPPPPGGPGGGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

result:

ok 

Test #41:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

45
XXX#.#X#X..####.###.X.#X####X.#X.#X##...X####
X.......XX.......XX...#.#.XX..............#.#
........XX.......XX.#.....#X.................
#.......XX.......XX.#...#........#...........
#..##...XX.....##...#.X.#........#.XX.......#
.....K................#............XX.....#..
....#...........#...#...

output:

74
6 6
LLGGGGGGGLGGLLLLLLLLLLLLLLLLLGGGGLLGGGGGGGGGGGGGGLGGGGGGGLGLLGLLLLLLLLLLLL

result:

ok 

Test #42:

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

input:

45
X.#XXX#X#.X.#..X#XXXX.XX#..X#.X###X.XXXX##..X
X.#..P......................................X
X.#.......###.#...............##.##.......#.X
X.#.....................................#.#.X
#..........#..#.#...........#X#..##.....#...X
X...........................................X
X...........####........

output:

NIE

result:

ok NIE

Test #43:

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

input:

45
#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX#
#.#...#.XX.#...#.XX..........#...#.XX...#...X
X.#.#.#.XX.#.#.#.XX######....#.#.#.XX.#.#.#.X
..#.#.#.XX.#.#.#.XX..........#.#.#.XX.#.#.#.#
X.#.#.#.XX.#.#.#.XX.######XX.#.#.X.XXK#.#.#.#
#.#.#.#....#.#.#.XX.......XX.#.#.#.XX.#.#.#.X
..#.#.#....#.#.#.XX##...

output:

334
11 3
GGGGGLLGGGLGGGGGGGGGGGGGGGGGGGGGGGGPPPGGGPPPPPPPGGGGGGPPDDDDDDPPDDDDDDDDDLDDDLDDDDDDLLDLDDLDDPPPPPPDDLLLLLLDDPPPPPPDDDPPPPPGGGGGGGGGPGGGLGGGGGGGPGGPGGGGGGGGGPPGGLLLLLLGGPPPPPPPPPDDDDPPDDDLLDDPPPPPPDDLLLLLLDDPPPPDDDPPDDLLLLLLDDPPPPPPDDDDDDDDDDDLDDDPPPPGGGGGPPPPPPGGLLLLLLGGGGGGGPPPPPPGGLLLLLL...

result:

ok 

Test #44:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

2
K#
#P

output:

2
1 1
LG

result:

ok 

Test #45:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

2
XP
K#

output:

2
1 2
DL

result:

ok 

Test #46:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

2
K#
XP

output:

2
1 1
GL

result:

ok 

Test #47:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

2
K#
PX

output:

1
1 1
G

result:

ok 

Subtask #3:

score: 30
Accepted

Dependency #2:

100%
Accepted

Test #48:

score: 30
Accepted
time: 8ms
memory: 5404kb

input:

200
....#.X.........#..X.XX.....#.....##.......#X.#.#.##..X...###.#....##.##.######XX.#...#.....#......#..X..#...##.#X........#.........XX#..X..X............#..X#.X.#.#X......##.#.X.....X................#
X.#........#....#...#.#...#..#..#....#.......X#X..X.#...#.....##.........#....#...X....X..........

output:

116
64 95
DDDDDLLDDDDPDPPDDDPDDDDDDDDDDDDDDDDDDDDDDDDDPPPDDDPPDDDPPDDDDDDDDDPPPPPPPPPPPDDDPPDDPPPDDPPPPPDDDDDPPPPDPPPPPPDDDPDD

result:

ok 

Test #49:

score: 0
Accepted
time: 8ms
memory: 5540kb

input:

200
#.......#XX...##.X..#.#....X.#..#....#XX#...###.#...#.....X##...#.##..........#....#X..#...#..#..X#....#....X.X###X..###X..#X.....#.#.##..#......#....#......#........##...X......#.X.X...X#..#X....#...
.#..#....##..............XX..#....##...#......##....#.........#.X....#.#...........X....###.#X#...

output:

128
115 60
GGLGGLGGGGLGGPGGGLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLGGGGGGGLGGGPGGPGGPGGGGLGGGGGGLGGGGGGGPGPGPPD

result:

ok 

Test #50:

score: 0
Accepted
time: 4ms
memory: 5484kb

input:

200
.X..........##.XX##.#####....#...#.#X#XX#..##..#.#.##.X..##.#..#......#.#.##...#..XX.#.##...###.....#....#...#.####..###..X##..#.X....##.X..#..##.#.#...#.X.#.X.X.#....##.X###..#X.##X#.X....XX.X####...
.#.....#.###........##.X#.....#..X....X.#.##.#X##....#...#..##..#...#.#.X...X.#..X###...#...#X....

output:

259
129 128
LLLLDLLDLLLDDDDLLLLGLLLLDDDLLLLLGLLLLDDLLDLLLDDLLLLLLDLLLDDDDPDDDLDDDDPDPDDLDDDDDLDDDLDDDLDLLLLDDDLLLLLLGLLDLDLLLDDLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLDLDDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDDLLDLLDLLDDDDDLLDLDLLDDLLLLDLDDDD

result:

ok 

Test #51:

score: 0
Accepted
time: 2ms
memory: 5424kb

input:

200
...#.......#..###.#.####.###X....#.#...###..##...#...#.#.#...#...#......###.##.#.###.##.#.......#.#....#..#.##..#.###...#.#..#....#......#.####.X#......###.#..##.###...#.##.X#.#.###...##.#...#......#X
.X#....#..##.####..#.##..#..#...####.#####.#.#.##....#..#..X..#.#...#....##.....#....##.#.#####...

output:

184
94 195
PGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLGGLLLLLGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDDLLDLDDDDDPPG

result:

ok 

Test #52:

score: 0
Accepted
time: 7ms
memory: 5548kb

input:

200
..................#.................................................................................................................................................#...................................
........................................................................................#.........

output:

95
120 140
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGGGGGGGGGGGGGGGGGGGGGGPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPGGG

result:

ok 

Test #53:

score: 0
Accepted
time: 8ms
memory: 5568kb

input:

200
#.XXX#.X..XXX..XXX#X#.X#X###.#.X#XXX#.X.X#.X..#..X.XX###..##X#XXX#.X#.##X.##XX#X..X#X#XX.###..XXXX.X##XXX.XXXX..X#.##...###X##..XX#X####.##X.##X#X.XX##XXX..XX#XXX#XX#.XXXXX..##..X######XXXX.X.#..##XX#
...#..X#..X....#X#..X#XXXX#.#.#.#...X#.X....X...XXX....X.X....X.....#.....XXXXX..X....X..#.#......

output:

406
139 150
LGGGGGPPGGGPGGGGGLGLGGPGGGPGGGGGGGLLGGGGGGGLLLLDLLLGGGGGGLLGLLDDLLLGGLLLDLLLLLGGGGLGGGGGGGGGLGGGGLLLLGGGGLLLLGGGGGGGGLLLLDLLLLGLGLLGLLLLGGGLLLDDLDLLLDLDLLLDLDLLLGGGGGLLGLLLLLGLLLLLLGGGGGGGLGGGLGGPGGLLLLLLGGGGGGLLGGLGLLGLLGLLLLLLLLLGGLLGGLLGGGGGGLGGGLGGGGGGGGGPGPPPDPPPGGLGGGLLGGLLLLLGGLLG...

result:

ok 

Test #54:

score: 0
Accepted
time: 4ms
memory: 5728kb

input:

200
#X..##XX#.XXXXX##.X..X.X.##XX#X#.#X.XX##.##XXXX.###....XX.X##X.X#.#X.XX..#X#X#XXXX..#X###X#XX#.#X#.X.XX.#X.#X##X.X###X...XX#X###X#X#XXXX...#.#X#X###X..XXXX.XXX.X#X#XX#..#.XX#.XX.X..XX..X.XXX..X#.###X#
X.................#..#..XX...........#.....X..X....#...X.X...#.#.......#X.XXX.....##.X.X.X........

output:

1961
181 106
PGGGPPPGGPPPGPPGPPPGGPPPPPPPDPPPPPDDPPGPPPPPPPPPGPPPPPPPPGGPPPPPPPPPGPPPPPPPPPDPDPPPPPPDPPPPPPPPGGGGGPGPPPPPPGPPPDDPPPDPPPPDDPPDPPPPDDDDDDDPPPPPPPPPPPDPPPPPDPDPPGPPPDPPDPPPPPPGGGPPPPPPPPGPPPGGPGPPPGPPPPGPPPPPPPPPGGGGGPPPPGPPGPPPPPPPGGGGGPGGGLLLGLLLLGLLLGGGGGLLGGLGLLLLLLGGGGGLLLLLGLLGGLL...

result:

ok 

Test #55:

score: 0
Accepted
time: 8ms
memory: 5556kb

input:

189
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
...#.#..XX.#..##.X.##..#..XX...#X....#.....X...X....XXX..#X.X.....XX......#X....XX#....##..#.....#.#.#X.#....

output:

1333
25 75
GGGGGLGGGGGGGPGGGGPPPGPGGGGGGPGGGGGGGGGGGGGGGGGGGLLGGGGGGGGPGGGGGGGGGPPGGGGGGGPPGGLGLLGGGGGGGGGLGGGGLGGGGLGGGGGGGGPGGGGPPGGGGGGPPGGGPGGGGGPPGGGPGGPGPPGPGPGGGGGGGGGGGGGGPGPGGGPPPGGGPPDPPDPPPPDDDDDDDDDDPDDPDDDDDDDDDDDDDDDDDPDDDDPDDDDDDDDDDPPDPPDDPPDDDPDDDDDDDDDDPDDDDPDDLDDDDDDPDDDPDDDDDDDDL...

result:

ok 

Test #56:

score: 0
Accepted
time: 3ms
memory: 5556kb

input:

195
XXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXX
X......#...........#.....XX.....#...#XXX#....##X#.......#.....#.XX.....#....................#..X.#.....

output:

3203
60 44
PPGPPPGGGGLLLLLLLLLLLLLDDDLLDDDDDPPDPDPPPPPPPPPPPPDPPPPPGGGGGGGGGGGPGGGPGGLLGLGGGLLGLLGGGLLLGLLLLLGLLLLDLLLLLLLLLLLLLLLDDDDPDDDDDDDDDDDDDDDDDDDDDDDDPDDDLDDDDPPPPPDPPPPPPPDPPPPPPPPPPPPPPPPPPPPPDPPPPPPPPPPPPPPPGGGGGGGLGGPGGGGPGGGGGGGGGGGGGGGLGLGGGGGGGGGGGLLLGGGGGLGGGLLLLLLLLLLLLLLLLLLGLLLLD...

result:

ok 

Test #57:

score: 0
Accepted
time: 2ms
memory: 5224kb

input:

189
XX#..#X#XX.X#X.#.#.###..#.X.X...#.##XXXXX#XXX.#X.XX.X...#.X#XX.#..X.X##.#X##.X####XXX...#.#..##X#XXXX#.XX###.#X..##X#..###X..XX..X...##X...X..XX#X.##XX.X.#X#..#.X#X.X.#..#XX#X#.#X.X##....XX
#...........#..#....XX..#.#..#.X......##XXX..#...#............XX...X.....#.....##.#XX..X..#....#........XX...

output:

385
166 189
GPPPPPPPGGGPGGGGPGGGGPPGGGGGGGLLLLLLLLLLLLLLLLGLLLGLLLLLLLGGGGGGGGGGGGGGGGGGGLLGGGGGGGGGLGGGGGPGGLGGGGGLGGGGGGGGGLLGGGGPPGGGGGGGGLLLLLLLLLLGGGGGGGGGGGGGGGGGLLLLGGGGLLLLLLLLLLLLLLGLLGGGGGGGGGGGGGLLLLLLLLLLLGGGGGGGLLLLLLLLLLLGGGGGGGGGGGLLLLLLGGGGGGGGGGGLLLLLLLLLDLLLLLLLLLLLLLLLLLLLLLGLLLLL...

result:

ok 

Test #58:

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

input:

189
.XX##X##.#X#.#XXX.#.X#..X.#X..###.XX#X###XX#..X#..#.X...X.X#.##..#XX#..##X.#.#X####X.XX####XX.#...X...XX.X#.X#.##X...X#####X##..X..#X##X.X..XXX#..XX#XX#X#...#.X.#X###.XXXX..X#.##...XX#.#X#.
##.....#..#.....#..#XX#.....#..#.....#..#XX#..#.....#..#.....#XX#.....#..#.....#..#XX#.....#..#.....#..#XX...

output:

362
11 31
LLLLDLDLDLDLDLDLDLDLDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok 

Test #59:

score: 0
Accepted
time: 4ms
memory: 5612kb

input:

195
#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
............XX...........XX...........XX...........XX...........XX...........XX...........XX...........

output:

3398
41 165
LLDDDPPDDPPPPDDDDDDDDDDDDDDDDDDLDDDDDDLLDDDDDDDDLLDDLDDDDDDDPPPDDDDDDPPPDDDDDDDDDLLDDDDDDDDDDDDDDDDDLLLDDDPPPDDDDDDDDDDDDDDDLDDDDDDDDDDDPDDLDDDDDDDDLLDDDDDDDDDDDDDDDDPPDDDDDDDDDDPDDDLLLLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLLGLLLLLLLLLGGGGGGGGPPGGGGGGGGPPPGGGGGGGGGGGGGGGGLGGLLLGGGGGGGGGGGG...

result:

ok 

Test #60:

score: 0
Accepted
time: 4ms
memory: 5276kb

input:

189
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X#..#.....#..#.....#..#.....#..#.....#..#.....#..#.....#..#...XX.............................................

output:

497
38 18
PPPPPGGGGGGGGGGGGGGGGGGGGGGGGPGGGGGGGPPPPPPPPPPPPPPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPPPGPGPPPPGPGPPPPGPGPPPPGPGPPPPGPGGGGPGGGGPGGGGPGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPDDPDPDDDDDDDDDPPPDDDDDDDDDDPDDDDDDPDDDPDDDDD...

result:

ok 

Test #61:

score: 0
Accepted
time: 4ms
memory: 5420kb

input:

189
.##X#.##.X..XX#X#...X.X#.XX#.XXXX#XX.XXXX#..##.XX.XX#....X##.X#.XX#.XXX#XX..XX.....##.####X##X.XXXX#..#..X###X##X#...X.#..X#..X.#...XX.#X#.X#..#XX##XXX#.#.#X#.##X.#.X..#XX#XX.X#X..XXXXXX.XX
X.#.#...#.......#...XX.#.#...#...#.#...#.XX.#.#...#...#.#.#...XX...................XX.......#...#.......XX...

output:

1664
177 20
LLLLLLLLLLLLLLLLLLGLLLLLLGGLLLLLLGGGGLLGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGGGGGGGGGGGGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPDDDDPPPPPPPPPPPPPPPPGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGGGPPGPP...

result:

ok 

Test #62:

score: 0
Accepted
time: 8ms
memory: 5456kb

input:

189
XXXXXXXX#XXXXXXXXX#X..X#X#XXXXX#XXX#XXXXXXXXXXXXXXXX#X#XXXXXXX#XXXXXX#X#X#XXXXXXX#XXXX#XXX#XXXXX#X#XXXXXXXXXX#XXXXXXXXXXX#XXXXXXXXXX#X#XXXXXXXXXXXXXXXXXXXXXX#X#XXXXXXXXXX#XXX#XXXXXXX#XXXXXX
X...#...#.#...#.#.#....X.#...#.X.#.....#......................#X.X.....X.#...#...#.XX...................XX...

output:

2181
19 69
DDDDDDLLLLLDDDDDDDDDDDDDDLDDPPDDDDDDDDDDDDDDDDDDDDDDDDLDDDDDDLLLLLLDDDDDDDDPPPDDPPPPPDDPDDLDDDPDDPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPPDDLLLLDDDDPDDLLDDDDDDLDDDDLLLLDDDDDPPDDPPDDLLLDDPDDLDDPDDDDDDPDDDDLLLLDDLLLLLLDDDDDDDDDLLLLLLLLLLLLGGLLLGGLLLGGGGLLLGLLLGGLLDDLLLLDDDDLLDLLLLLLDDDL...

result:

ok 

Test #63:

score: 0
Accepted
time: 2ms
memory: 5456kb

input:

189
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#...#...#...#...X.#.X#.#.....#.#.#.......X#...#...#.......X.#.XX...................XX...................XX...

output:

2297
9 14
DDDPPPDDLLLLLLLDDLDDDDPDDPDDDPPDDDDPPDPPDPPPPDDDDDDDDPPPPPGGGGPGGPPPGGPPPGGGGPGGGGGLLGGLGGGGGGPGGLLGGGGPPGGPPGGLLLLGGGLLGGGGLLGGGLLLGGLLLLDLLLLGGGLLDLLGLLLLGGLLLLDLLDDLLDDDDLLDDLDDPPDDDDDLLDLLLLLLDLLLLLLDDDDDDDDDDDDDDDDDDDPPPPDDLLLLDDPDDPDDDDDDDDDDPPPDDPPPPPPPDDDDDDDDPPPPPPDDDDPPPDPPPPPPPP...

result:

ok 

Test #64:

score: 0
Accepted
time: 7ms
memory: 5552kb

input:

189
#X.XXX..X#.#.XX..###XX##.X####X.######X..X.#X#X.#XX#X.X.#.#..X#X...XX.X#X#.##X.#.##X##.X..X#XX#.#XX..##........X...X#.XX#..##.X####.X#X#X#.X#.#.X.X.X.#.#XX.X#..X##X..#...XXXX...#X..XX#..#.#
X...#...#...#...#...XX...................XX.#...#...#...#...#.XX.#...#...#...#...#.XX.#...#...#...#...#.XX...

output:

579
107 128
LLGLLLLGGGLGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGLLGGGGGGGGGGGGGGGGGGGGLLGLLLLLLLLLLLLGGGLLLLLLLGGGGGGGGGGGGGGGGGLLLGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGGGGGGGGGGGGGGGGGGGGPPGPGGPPPPPPPPPGG...

result:

ok 

Test #65:

score: 0
Accepted
time: 2ms
memory: 5520kb

input:

189
X..X#XX#XX###.XX##X.X.##...X#.XX.#X#.###.#X.X##.#..##X..####..#...X..#XXX#.##.X#X#...X#.#.X##.X##..X.#...##.#.#...XXX.#XX##..X.##.##X##.#.XX.#X###..#.X.#..##....#.###X.X.X#X#XX####X.#.X..X.
X...#...#...#...#........#...#...#...#...XX...#...#...#...#...XX...................XX...................XX...

output:

10029
173 23
DDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGPPPPPPPGPPDPPDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGPPDDD...

result:

ok 

Test #66:

score: 0
Accepted
time: 6ms
memory: 5472kb

input:

189
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X...#...#...#...#...XX...#...#...#...#...XX.#...#...#...#...#.XX...................XX.#...#...#...#...#.XX...

output:

8707
23 173
DPPPPPPPDDLLLLLLLLLLLLLLLLLLDLLDLDDLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLLLLLLGGLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLGGLLLDDLLLLLLLLLLLLLLLLLLDDLLLGGGGGGGGLLDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDD...

result:

ok 

Test #67:

score: 0
Accepted
time: 3ms
memory: 5412kb

input:

187
#.##X##...#X.#..##XXXX#X#X..##X#XX###XX##.X.#X#...#XX##.X#X#XXX..X.X.#X..XX...##.#.##XX#..X.##.X#..#X#.#XXX#XX#XX#.X.##XX#X##X#X.X.X#XX#XX#.X.#XX.#.XX.XX....##X.X#..#X#.#X.X..XX#.###X##XX
X...............XX...............XX...............XX...............XX.#...#...#...#.XX...#...#...#...XX...#....

output:

8196
6 172
LGGPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLLDDDDLLGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDLLGGGGGLLLDDDDDLLDLLLGLGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGLLD...

result:

ok 

Test #68:

score: 0
Accepted
time: 5ms
memory: 5640kb

input:

200
P#######################################################################################################################################################################################################
###############################################################################################...

output:

398
1 199
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok 

Test #69:

score: 0
Accepted
time: 7ms
memory: 5544kb

input:

190
#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.
..#...#...#...#...XX....................................XX.#...X...#...#...XX.................XX.#...#......

output:

7112
116 141
DDDDPPDPPPPDDPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLDDPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLDDDLLDDPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPDDLLLLLLLLLLLLLLLLDDPPPPP...

result:

ok 

Test #70:

score: 0
Accepted
time: 7ms
memory: 5636kb

input:

198
XX##X.XX.##.X#.##.XXXX#XXXX#X.X.XXX.###X.##X...XX.#X#X#.#X..X...X.#XX#X#..X...XXXX.XX.#..XX..XX#.#XX##XXXX#XX##X###.###X.X#X#.X.XX#X#.#.#.XXX#.XXX.#X#X....X#..X#.#XX.XXXXX.#XXXX.##.X.#X.#XX..#XXX#.#
X...............................XX...............................XX.................................

output:

1229
117 20
LDLLLLDLLLLDLLLLDLLLLDLLLLDLLLGGLGGLGGLGGLLLLLLLLLGGGGGGGLLGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDLLLLLLLDDDDDDLDDDDLLDDDDDDLLLDDDPPPPPPPPPPPDDDDPDDPPDDPPPPPPPPPPPPPPGPPDDDPPPPPPDPPPPPDPPPPPPPPPP...

result:

ok 

Test #71:

score: 0
Accepted
time: 6ms
memory: 5448kb

input:

190
####XX.#.#.X###XX...X#...#..X###XXXX.X#X###XX.XX##X.##X.X.#X##X####.#X#..#X##XX.XX.#X#XXX#.###.#XXX#.#XX......#.##X#X#..XX.X##.#X.XXXXX#X.X..X.X#..####X#X##.#.#X.#XX..X#XX.#.#.#.X.X..XXXXX..
..................XX.#.X...#.#.#.#...XX.X...#.....#.....XX...#.....#.#.....XX.#...#...#...#...XX............

output:

374
148 155
LLLDLLLLDDLLLLDDLLLGGLLGLGLGLLLLLGGLLGLLLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLLLLLLLLLGLGGGLGGGGGGGLGGGGGGGGGGLLLLLGLLLGGGLLLGGGGGGGGGGGGGGGGLGGGLGGGGGLGGLGGGGLLLLLLLLLLGLLGLLLLLLLLGGLGGLLLGGLGGGGLLLLLLLLLGLGGGGLLGGLLLLLLLLLLGLGGGGGGLGGGGLLLLLLLLLLLLLLLGLGGGGLGGGGGGGGGGGGGPGGPGGLGGGGGLLLLGLLLG...

result:

ok 

Test #72:

score: 0
Accepted
time: 3ms
memory: 5624kb

input:

195
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X.###..X.....#...#...#......#..#.#...#XX.X...#...#...#...#...#...#...#...#...XX.#...#...#...#...#......

output:

3496
176 158
DPPPPPPDPPDPDPPPPPPPDPPPPPGGPPPDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGG...

result:

ok 

Test #73:

score: 0
Accepted
time: 8ms
memory: 5264kb

input:

189
#XXXX..XXX..#X#X#XXXX..#X...X.....##....X..X##X..X.###XX#X#...XX###.#...###.XX##XX#XX#X##.X#X#.###X#..#..##X##XXX##.XX#XX.XX#.##XX.X.###...#####X#.#X.....#X#.X..XX..#..X..X#X.##.###.X.X..X.
X.#.....XX.......XX.......XX...#..#XX.#.....XX................XX....#..XX.#.....XX...#.#.....................

output:

381
5 4
PPPPPPPDDDPPPPPPDDDDDDPPPPPDPPPPPPPPPDPPPPPPPDPPDDDPPPPPPPPPDDDDPPPPGGGPPPPDPPDPPGPPPPPPDDPPPPDDDDDDDDDDDDDDDDDDPPPDDPDDDPPDPDDDDDDDDPPDDDDDPPPDPPPPDDDDDDLLDDDDPDDPDDPPPPPDPPDDPDPPPPPPPPDDDPPPPDDDDPPPDPPPPDDDDPPDDPPPPPDPPDPDDDDDDPDPPPPPPPPDDDPDDDDDDPPPPDDPPDPPDPDDDDDDDDDDPDDPPDPPDDDPDPPPPPPD...

result:

ok 

Test #74:

score: 0
Accepted
time: 7ms
memory: 5636kb

input:

198
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
..#...#...#...#...#...#...#...#...X...#...#...#...#...#...X...#...#...#...#...#...#...#...#...#.....

output:

2682
139 8
PGGGGGGGGGGGGGGGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPGGPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

result:

ok 

Test #75:

score: 0
Accepted
time: 7ms
memory: 5484kb

input:

200
##..X.#......#...X.#.#.#.#.X.#XXXX#.....X...#....X.#...#......#.#....X#.#.X..#XX#....#..X##..###.#..#X..#..........X#...X#....#...#.##...#X.##.#...#..#..#..X###.#.#.X.....X...X..XX...X.......#X#.##...
..#...X#..X.....#X.X##..##.#.##X#X.#.X.#..X....#.X...#X.....#.....#.X.#...#......X...##.X#...#X...

output:

18
65 95
LLGGGGGGGGGLLGLLLL

result:

ok 

Subtask #4:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #76:

score: 40
Accepted
time: 213ms
memory: 56688kb

input:

1000
.#.X#.........X#........X.#X.X..XX...##...............####X..#..#.X....#X.........#..X.#X...##.#.X#....X#....#X#........#.#.X...X......XX.............#.X..........#X#..#.#..#XX..XX...............#..#...##.#...XX......#..#.........X.....#.................#.....#.#.X.....X...X#.#....X.......###.#...

output:

961
104 304
PGGPPPGPPPPPPPPPPGGPPGGGGGGGGPGGPPGGGPGGGGGGGGGGPPPGPPPGGPPPPPGPPPPPGGGGGGGGPGGGGGGGPGGGGGGPPPGGGGGGLGGPGGGGGGGPGPGGGGGGGGPPPGPGPGGPPPPPPGGGPGGGGGGPGGGGGGGPGGGGGGPGPGGGGGGPPGGPPGPPGGPPPPGGGGPGPGGLGGPPGGGGGGGPGPGPGPGGGGPGPGPGGGGPPGGPPPPPPGPGPGGGGGGPPPPPGPPGGGGGGPGGGPPPGGPGGGGLGGGGGGGGGGPP...

result:

ok 

Test #77:

score: 0
Accepted
time: 217ms
memory: 56724kb

input:

1000
X.....#.X..X.#X..#..###.#.X....#.#.....#..X#..X#..#...............X...##...#.....XX..#..#....###...#.#X................XX#...#.....#X....X........#.....#X...#..........#....####....#..#....X.#.#.X.....X...#.X##....#.#X.....X..X##X...#.#.X..XX.#.#X.......#.X......#..#X.X...##.X..X.....#.......X....

output:

774
183 740
PPPPGPPDPPDDDPDDPPPDPDDDPPDDPDDDDLDLDDDDPDPDPDPPDDDDPPDDDDDDDDDDLDDDLDDDPDDPDDDPDDDDDDDDDDDDDDDDDDDLDDDLDDDDDPPDDDDDDPPDDDDDDLLLDDDDDLLLDDDDDDLDLLLDDDDDPPDDDPPDDPDPDDPDDDDDDDDDDDDDDDDDLLLDLDDPPPDDDDDDDDDDDDDDDDDDPDDLDDDDDDDDDPDDDDLDLDDDPDPPPDDPPDPDDDLDLLLLDDLLDDDDDDDDDDLLDDDDDPPDDDDDDDDD...

result:

ok 

Test #78:

score: 0
Accepted
time: 188ms
memory: 56604kb

input:

1000
X..#..X#...X.X....X.#X..##.#....X..#X.#.X##.........#.X#........##.##X..#.X...#.#X.#.X.....X..#.##.....#.#..#XX...#..#X.##.....#...##..#.##.X.#.X##.......#.#...##..#..X#.#.....X#..X.#X.#X..#.....#...#.##.#X...#..#...#X#..X##..#.##....##.XX...#..#..#...#.XX###...###X..#.....X..#..X.X..#..#X.X.X#...

output:

665
692 679
LLDLLGLLLLDLLLDDLDDDDDDDDDDDLLLDLDDLLLGLGGGLGGGGGLGGLLLLLLLGGLGGLGLLLGGLLGLLLLLDLLLLDLLLLLDLLLLLGGLGGGLGGGGGGLLGGLGLLDLDLDLLLDDDDDDDDLLDDDPDDDDDDLLLLDDDLDDDPPDDDDDDDDDDLDDDLLDDDLLGLLLLLGGLLLGLLGGGGGLGGPGGPGGGLLLLLLLLLLGLGLLGLLGLGGLLGGLGLGGLLGLLLLLLGGGLLLLLLLLLLDLLLLLGLLLLGGLGLLGLLDDLDLLL...

result:

ok 

Test #79:

score: 0
Accepted
time: 158ms
memory: 56632kb

input:

1000
#....#.##...#.......##.###.#.#.#..#.........###...#..##..#.X##.##.###.#####..#....X.#..X..#.####.#..#....##X#.#...#.##.#..#.##..####...X...X.X.##...###..#X#.##.#..##...#.#.....##.X.......##.#............##.......#...........#.###..X##.#.....X.##..#.##..##...#.#....###..###..##.......#...##.#.X....

output:

2713
866 866
PGPPPPGGPPPDDPPPDPPDDDPDDDDDPDDPDDDLDDDLDDDDDLDLDLLDDDDDDLDLLDDLDDDLDDDPDDLDLLLLGLLLLLLLLLLLLLLLDDDLDLDDDLDLLLGGGGGLLLGLLGLLLDLDLDLLLLDDLLDLLGLLLLLLLLDLLLLLDLLDDDDLLLLLLDDDDDDLLGLLDLLLLLDLLLLLLLLDDDPDDDPDDLDDLDLLDLLLLLLLDLDLLLLGGLLDLDDPDDDDLDDDDDLLLLGLLLDLLGLLLGLLLLLGLLLLDLLLLLLGLLDLLGL...

result:

ok 

Test #80:

score: 0
Accepted
time: 200ms
memory: 56628kb

input:

1000
...#.#..#..##....#......X.....###....##..X.#...#.......###X##...#.X#.......#...#..X.....#.....###.#....#X.X#X#X#.....#..#..##.X.#....###...X...#...#.#.#.##.#.##..........#.#.#..X..X..XX.X#.....##...#.X....#.#...#.X..#.......#.....#...#.........###.X.#..#.#X..###..#X.......X...#.##......#.X##.##...

output:

1266
656 522
DLDDLDLLLLLLLDLLLDLLDLLDDLLDDLDLLLLDLLLLLLDDDDDDLLLDDDDDDLLDLLDLLLLLDLLLLDDLLDDLLLLLGGLLLLLLLLDDDDPDPDDLLDDLLLDDDDDDLDDDDLLLDDDDDDDDDDLDDDDDDPDDDLDDDPDDLLDDLDLLLLDDDLDDLLDDDDDLDLLLLLGGLGLLDLLLLLLDLLGGLGLLLLGLLLLLDDLLLLDLLLDLLDLDDDLLLLLDDDDDLLLLLDLLLLLLLLDDLDLLLDDDLDLLLGLLLLLLDDDLDLDDDDL...

result:

ok 

Test #81:

score: 0
Accepted
time: 200ms
memory: 56588kb

input:

1000
X....#XX....#.#XX.XX.#X.#XX..#X..X.....#.XX##...X...X...X#......X...#X..XX..X.X..X..#X.X......X#X...X#...X.#.X.#.X.X#.XX.X.#...X.X..X.....#X#X.X#.#X...X...............#.###.#.#.X#X#X..#XX.#.#.X.....X.X............X.#..#.#.....X##.XXX.XX.X..##........X....X....X.X..X.........X#......#.#.##...##X...

output:

996
695 669
DDLLLDDLLLLLLLGLLLLLLLLGLLLLLLGLLGGGGLGLGLLGGGLGLGGGLGGGGGGLLGLLGGGGGGLLLLLLLLDLLDLLLLLLLLLLLLLLLLLLLLLLLDLDDLLLGLLLLLLLLLLLLLLGLGLLLGGGPGGLGGGLGGGGGGLLLLGLLGGGLLLLGGGGGGGLGLGGLLLLLGLGLGGGLLLGLGGGLLGGGGLLGLLGGGGLGLLLDLLLGLGGLGGGGGGPPGGGLGGGLGGGGPGGGGGGLLLGGGGGLGLGLGGGGLLDLLLLGLLLLGGLLLGL...

result:

ok 

Test #82:

score: 0
Accepted
time: 213ms
memory: 56612kb

input:

1000
XX..#X.......#..X.X#X....#.X....XXX..X#......X#...X..X....X.#.##...#..XXX#XX...X.#.#..XX..#.X..XX.....X...X.#XX..#.............X...#......X.XX....X..X.X.......X..XX.X.X..XXXXX.XX..X.#X.#X.#.XX..X.......X#..........XX.X..#XXX.X...#.......##.#X..X..X.X.#X.......XX....X.X#X#..XX#....XX...#X..#X.##...

output:

1016
316 609
DLLLLLLLGLLGLGGLLLLGLLLLLLDLLLLLLLDLLLLLLLLLDDLLDLLLLDDDDLDDLLLLLDDDDDLLLLLDLLDDDDDDDDLLLLDLLLLLLLDDDDLDDLLLLDLDLLDDDDLDLLLLDDDDDDDDLLDLDLLLLLLLLLLLGLLLLLLLLLLLLDLDLDLLDLDDPDDLDLLDLLLLGGGLLDLLDLLDLDDDLDDDDDDLLLLLLLLLLLLLLLLLLLLDDDLDLLLLDDLLLDLLLLGLLDLDLDLLDDDLDDDLLLDDDLLGLLLDLLLLLLLLLDL...

result:

ok 

Test #83:

score: 0
Accepted
time: 38ms
memory: 56584kb

input:

1000
PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

1001
2 1
DPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

result:

ok 

Test #84:

score: 0
Accepted
time: 141ms
memory: 53504kb

input:

969
X.XX##.#..X.X.##X.XX.X.#..XXX#X#X#X#.##X..#.X.X##XXXXXXX##X#X.X.##..X.X.#.XXX#XX###X#.X#.#X###X...XXXXX..X.#X...##XXX.#.XX.XX..##XX#.#X.#.##X...##..##X#.X.X#X#XX#XXX.XX##.X..#...#X..X.#.X##.X#..#X#..XX#XXX#X#X.#X..####.X#X##...X.#X#X#.X###..X#.X..X###...#.#XXX#.X#.X..#XX.XX...XX..X##X#####XX.#.....

output:

1928
946 16
PPGPGPGGPGPGPPPGGGGGPGGPPPGGGGGGGGGGGGPPGGGPGGPPPPPPPPPPPPPPGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPGPPPGGGGGGGGGGGGGPGPPPPPPPGGGPPPPPPPPGGPPPGGGGGGGGGGGGGGGPPPPGGPPPPPPPPPPPPPGPPPPPPPPPPPPPPPPPPGGPPPGGGGGGGGGGGPPPPGPPGGPPGGPPPPPPPPGGPPPGGGGGGGGGGGGGGGGGPPPPPPPPPPPPPPGGG...

result:

ok 

Test #85:

score: 0
Accepted
time: 199ms
memory: 52460kb

input:

957
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

34718
321 830
DDDLLLDDDDDDDDDPDDDDDDDDDDDDDLDDLDDDDDDDDLLDDDDDDDDDDLDDDDPDDDDDDDDDDDDDDDDDDDDDDDDPDDDDDPDDDDDDDDPDDLDDPDDDPDDDPPDDDDDDDDDLDDDDDDPDDLDDDDDDDLDDDDDDDDDLLDDPDDDDDDPDDDDDDPDDDPDDLDDDDDDDLDDDDDDDDDDDDDDDDDDDDDLDDDDLDDDDDDDLLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDLDDDDDDDDDDDDPDDDDDPDDDDDDDDDPDPDDD...

result:

ok 

Test #86:

score: 0
Accepted
time: 139ms
memory: 53432kb

input:

969
XXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

49339
615 615
DLLLLDLLLLDLLLLLLLLLLLLLDDDPDDPPPPPPPDDDDDDPPPPPPPPPPPPGPPPPPPPPPPPPGGGGGGGGGGGGGGGGGGGGGGGGPGGGLLLGGLLLLLLLLLLLGLLLLLLGLLGGLLLLLLLLDLLLLDLLLLDLLLLLLLLLLLLLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPDDDDDDDPPPPPPPDDDPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPDPPPPPPPPPPPPPPPPPPDPPPPPPPPGGGGGPGGGL...

result:

ok 

Test #87:

score: 0
Accepted
time: 115ms
memory: 52276kb

input:

969
X.#X#X.##..XX#X.X.....#XX##X##X..#.###......X.#X#.#..X#XX.XX#.XX#.X..#X#X##X#XX..X##X####.#X#X#.X#X##XX.#.X#XX#.#XX#X.X.#...##..##.###X#.X..#.X#.X#..#..#.#.#...###..#XX..#.XX...##XX##...#X#.#.X#XX.#...X#X##.#..X#.X#....#X#XX.####...X.#.X....XX.X##X.#.X#X#.XX#.####XX#XX..X.#XX##XXXX.X.#X###XX.......

output:

NIE

result:

ok NIE

Test #88:

score: 0
Accepted
time: 98ms
memory: 52404kb

input:

969
.#.X...##X#.X#X##.X##XX#.X#X###..#.X.#X#X##.X##.XXX.X...#X##.#X##X####.X##...##.#X.##X.X.XX##..XX.#X.XXXXXX#.X.#..#X###X#.##X..###XXX.X#X##XX...X##XX#.#.X.X.XX.X..X.XX.XX##.X..XXX.#XX.#..#X.XXXXX.#.X.#XX##X#.#.##.X.##X###XX.X#XX#.X.#X.#X#...X#.#.#X..X#.#X.X.#X###XX#.#XX..#XX#XX#X#.#X#.XXX#X#..##...

output:

NIE

result:

ok NIE

Test #89:

score: 0
Accepted
time: 145ms
memory: 52660kb

input:

961
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

31320
946 17
LLLLGGLLLLLLLLLLGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...

result:

ok 

Test #90:

score: 0
Accepted
time: 168ms
memory: 52600kb

input:

961
#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

34666
21 636
DPPDDDPPDDDDPPPPDDDDDDDDDDDDDDDDDLDDDDDDDDDDDDDDDDDDDDPPPPPDDDDDDPPPPDDDDDDLLLLLDDLLDDDDLLDDDDDDPDDLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLDDDDLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPPDDD...

result:

ok 

Test #91:

score: 0
Accepted
time: 173ms
memory: 52660kb

input:

961
.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

35766
462 109
GGPGGGGGGGGGGGGPGGPPPGGGGGGGGPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLGGGGGGGPPPGGPPPGGGGPGGGGGGGGGGGGLLLLGGLGGGGLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPGGGGGLGGGGLLLLGGPGGGGGGLGGPGGGGGGGGGGPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLGGGPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPGGGGGGGPPP...

result:

ok 

Test #92:

score: 0
Accepted
time: 173ms
memory: 52712kb

input:

961
.X.#X.XX#.XX#XXX##X#X.X######.XX.X#X#.#.X.X#X...X.##.#.X##....X#XX.#.XX.X.X#.##.....X.X.##..#XXXX#.#XX#X...XX##XX....X...XX..#X.#X..#.###.#XX#X..XX####.#X...XX#X..X.XX.#.X#X.X.#.X#X..##X#X.#X..X.#.#X#..X.#X#X#.###XX#XX#.##.####X#XX.#X.X.X...#.#X#.X#XX#..#.##X###..X#XX#.X##XX.X#.X#.X.XX##.##..#.....

output:

1900
43 42
PDDDDDPPDDDPPDDDPPPPPPPPDDDDDPPDDDPPDDDDDDDPPPPDDDPPPPDDDPPDPPPPPPPPPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPDDPDDPPDDPPPDDDDDDDPPDPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPPPDDDDDDDDDPPDDDPPPPPDDDPPDDPPPPDDPPPDDDDDDPPPPPPPPPPPPPPDDDLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPDDPPPPPDDDDPPPPPPPPPPPPDDDDDD...

result:

ok 

Test #93:

score: 0
Accepted
time: 142ms
memory: 53936kb

input:

969
.X#.#...#X.##.#X#XX#..#XX.####.####.##X#X#XXX.X.X.X.#.##XX#XX###..XXXX.X.##X..X.##XX.X.X###X.#.#X####X###X.X..X#.X.X.X.X#XXXX##XXXXXX#.##X..XX..#X##.X.#XXX.X.X#..#XXX#XXXX.##XX###.#XX.#.X#.X.#X.X.#..XXX.##.XX..#.##.#XX#XX..X.X##.X#.X###.X#.X.XX#.#X.#.##X.X.#..X.#X.##.XX...X.XXX#.#####..X#.XXXX#....

output:

201867
274 952
LLLLLLLLLLLLLLLLLLLLLLLLLLLGGGGGGGGGGLLDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDLLGLLLGLLLLLLLLLLLLLLLLLLLGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGLLDDDDDDDD...

result:

ok 

Test #94:

score: 0
Accepted
time: 134ms
memory: 53912kb

input:

969
X#X#X##XX.X..XXX#..X#XXX#XXXXXX#X#X.XX.#X.X#.#X.####..#.#XX.XX..X.XX#XXXX#.#XX.X###X#.XX..#.X..#.XX.#..X..#X....X...X.##..X#..#..XX#XXX.X##.#..X.#.X.X..XX.X#.XX.X..#.##X.###.##..XX.#..X.#.#..#.#....#.##X###.X###X...X.X###X##XX#.X##.X#X.#.#XXXXX#.....##.XX.X#X....#X..XX.#XX#########..#.XX.X#.XXXX...

output:

193243
258 921
LDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLDLLLGLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...

result:

ok 

Test #95:

score: 0
Accepted
time: 156ms
memory: 54324kb

input:

975
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

227680
257 709
PPPPPPPPPPPPPPPPPPPPPPPPPPPPDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGG...

result:

ok 

Test #96:

score: 0
Accepted
time: 182ms
memory: 55532kb

input:

989
####X#X..#X...XX#X#..#.X#.#.X.##..##X#.XX##...X##XX####..X#..XXX#.X#XXX##..####....X....##.###..#X#.XXXXX###.XX...#.#...X#X#####X.#.X#X#X##.X#.X##X##..X.XXX.X.X..XXX.#XX..X##X.X#.#XX...XX##..XX##XX#.X###X.#####X##XXXXX#XX.XX.##X..X.X#.#X.#.###XX...##.#...#X#.##X#XX#X#X#X##.#..X#XX#.XXXXX##..#XXX...

output:

3287
579 69
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLDLLLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLLDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDL...

result:

ok 

Test #97:

score: 0
Accepted
time: 125ms
memory: 53004kb

input:

961
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

204727
510 1
GPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGGGGLLLLLLLLLLLLLLL...

result:

ok 

Test #98:

score: 0
Accepted
time: 151ms
memory: 52960kb

input:

961
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

97435
329 624
PPPPPPPPPPPPPPPPPGGPPGPPPGGGGGGGGGGGGGPGGLLGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDLDDDDDDDDDDLDDDDDDDDDLDDDDPDDPDDDDDDDDDPPDDPPDDPDPPPPPPPPPPPPDPPPPPPPPDPPPPPPPPPDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDD...

result:

ok 

Test #99:

score: 0
Accepted
time: 164ms
memory: 52664kb

input:

961
.#XX#..#..X..#.#XX##.X.#...X.#X#.X.X.#XX#X..###X.#XX##..X#.#X.##.X#X....#X#...##X#.#X.X#...X##.X.###X###XX.X...XX.X.#.XX.XXX.#....##.#X..X#...X..#.#...#XX#.X#.##.##X..#X#.#..XXX.#XX#.X..#X#.X...X#..XX#.#XX#....XX.##XXX.#.#..X.X###XXX..X####X#.#XXX#XX.XX......##.##XXX##.#X.#.#XXXX.X.XX#...X..#XXX...

output:

2921
33 946
LLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPGGGPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPGGLLLLL...

result:

ok 

Test #100:

score: 0
Accepted
time: 141ms
memory: 56348kb

input:

999
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

5664
294 856
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

result:

ok 

Extra Test:

score: 0
Extra Test Passed