QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#71501#2662. Bombermanpibuxd10 224ms57164kbC++144.6kb2023-01-10 23:24:572023-01-10 23:24:58

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:24:58]
  • 评测
  • 测评结果:10
  • 用时:224ms
  • 内存:57164kb
  • [2023-01-10 23:24:57]
  • 提交

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);

  if(dp[K[0]][K[1]] == INF){
    cout << "NIE\n";
    return 0;
  }
  
  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 = n*n+3;
  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};
      }
  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: 3372kb

input:

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

output:

8
1 1
PPDPDDDP

result:

ok 

Test #2:

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

input:

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

output:

16
1 1
LLLLDDPPPPDDLLLL

result:

ok 

Test #3:

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

input:

2
PX
.K

output:

2
1 1
DP

result:

ok 

Test #4:

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

input:

2
P.
K.

output:

1
1 1
D

result:

ok 

Test #5:

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

input:

2
P.
.K

output:

2
1 1
PD

result:

ok 

Test #6:

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

input:

2
PX
XK

output:

NIE

result:

ok NIE

Test #7:

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

input:

3
P.X
...
X.K

output:

4
1 1
PDPD

result:

ok 

Test #8:

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

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: 0ms
memory: 3540kb

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: 3456kb

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: 207ms
memory: 56624kb

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: 224ms
memory: 56516kb

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: 201ms
memory: 56892kb

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: 31ms
memory: 12472kb

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: 11ms
memory: 11936kb

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: 2ms
memory: 3408kb

input:

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

output:

12
1 1
PPPPPPDDDDDD

result:

ok 

Test #17:

score: 0
Accepted
time: 197ms
memory: 56336kb

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: 116ms
memory: 57164kb

input:

999
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

270890
39 698
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

result:

ok 

Test #19:

score: 0
Accepted
time: 132ms
memory: 56860kb

input:

999
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

253897
2 16
PGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGPPDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDPPGGG...

result:

ok 

Test #20:

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

input:

2
KX
XP

output:

NIE

result:

ok NIE

Test #21:

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

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: 3368kb

input:

2
PK
..

output:

1
1 1
P

result:

ok 

Test #23:

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

input:

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

output:

167
38 39
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGLGGGGGGGGGGGGGGG

result:

ok 

Test #24:

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

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: 5756kb

input:

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

output:

4281
108 189
PPPPPPPPPDDLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

result:

ok 

Test #26:

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

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: 155ms
memory: 56588kb

input:

1000
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

50730
3 302
LLLLLLLDDDDDDDDDDDDDDDDPPPPPPPPPPPPPPPPDDDDDDPPPPPPPPPPPPPPPPPPPPPPPPPGGGGPPPPPPPGGGGGPPPPPPPPPGGGGGGGGGGGGGGGGGGGGGGGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLGGGGGGGGGLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDDDDDDDDDDDDLDDDDDDDDDDDDDDDDDDDDDDDDDPPPPPPPPPPDDDDDDDDDDDDDDDDDDDDDDDDDP...

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Test #28:

score: 0
Wrong Answer
time: 1ms
memory: 3460kb

input:

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

output:

NIE

result:

wrong answer 

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%