QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#804652#9478. Shift PuzzleKKT89AC ✓17ms4060kbC++205.9kb2024-12-08 01:40:442024-12-08 01:40:45

Judging History

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

  • [2024-12-08 01:40:45]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:4060kb
  • [2024-12-08 01:40:44]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) { return (ull)rng() % B; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<string> s(n), t(n);
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
    }
    int cnt_s = 0, cnt_t = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cnt_s += (s[i][j] == '#');
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cnt_t += (t[i][j] == '#');
        }
    }
    if (cnt_s != cnt_t) {
        cout << "No" << endl;
        return 0;
    }
    if (n * n - cnt_s < cnt_s) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                if (s[i][j] == '#') s[i][j] = '.';
                else s[i][j] = '#';
            }
        }
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                if (t[i][j] == '#') t[i][j] = '.';
                else t[i][j] = '#';
            }
        }
        cnt_s = n * n - cnt_s;
        cnt_t = n * n - cnt_t;
    }

    vector<pair<int, int>> res1, res2;

    auto op1 = [&](int t, int x) -> void {
        res1.emplace_back(t, x);
        if (t == 1) {
            char c = s[x][n - 1];
            for (int i = n - 1; i > 0; --i) {
                s[x][i] = s[x][i - 1];
            }
            s[x][0] = c;
        } else {
            char c = s[n - 1][x];
            for (int i = n - 1; i > 0; --i) {
                s[i][x] = s[i - 1][x];
            }
            s[0][x] = c;
        }
    };
    auto clean1 = [&]() -> void {
        int cnt = 0;
        for (int i = 0; i < n; ++i) {
            cnt += (s[i][n - 1] == '#');
        }
        for (int i = n - 1; i >= cnt_s / (n - 1); --i) {
            while (cnt < n) {
                int jj = -1;
                for (int j = n - 2; j >= 0; --j) {
                    if (s[i][j] == '#') {
                        jj = j;
                        break;
                    }
                }
                if (jj == -1) break;
                while (s[i][n - 1] == '#') {
                    op1(2, n - 1);
                }
                for (int j = 0; j < (n - 1) - jj; ++j) {
                    op1(1, i);
                }
                cnt += 1;
            }
        }
    };
    for (int i = 0; i < cnt_s / (n - 1); ++i) {
        clean1();
        while (true) {
            bool ok = true;
            for (int j = 0; j < n - 1; ++j) {
                if (s[i][j] != '#') {
                    ok = false;
                    break;
                }
            }
            if (ok) break;
            while (s[i][n - 1] != '#') {
                op1(2, n - 1);
            }
            op1(1, i);
        }
    }
    clean1();
    while (true) {
        bool ex = false;
        for (int i = 0; i < n; ++i) {
            if (s[i][n - 1] == '#') {
                ex = true;
                break;
            }
        }
        if (!ex) break;
        while (s[cnt_s / (n - 1)][n - 1] != '#') {
            op1(2, n - 1);
        }
        op1(1, cnt_s / (n - 1));
    }

    auto op2 = [&](int type, int x) -> void {
        res2.emplace_back(type, x);
        if (type == 1) {
            char c = t[x][0];
            for (int i = 0; i < n - 1; ++i) {
                t[x][i] = t[x][i + 1];
            }
            t[x][n - 1] = c;
        } else {
            char c = t[0][x];
            for (int i = 0; i < n - 1; ++i) {
                t[i][x] = t[i + 1][x];
            }
            t[n - 1][x] = c;
        }
    };
    auto clean2 = [&]() -> void {
        int cnt = 0;
        for (int i = 0; i < n; ++i) {
            cnt += (t[i][n - 1] == '#');
        }
        for (int i = n - 1; i >= cnt_s / (n - 1); --i) {
            while (cnt < n) {
                int jj = -1;
                for (int j = 0; j < n - 1; j++) {
                    if (t[i][j] == '#') {
                        jj = j;
                        break;
                    }
                }
                if (jj == -1) break;
                while (t[i][n - 1] == '#') {
                    op2(2, n - 1);
                }
                for (int j = 0; j < jj + 1; ++j) {
                    op2(1, i);
                }
                cnt += 1;
            }
        }
    };
    for (int i = 0; i < cnt_s / (n - 1); ++i) {
        clean2();
        while (true) {
            bool ok = true;
            for (int j = 0; j < n - 1; ++j) {
                if (t[i][j] != '#') {
                    ok = false;
                    break;
                }
            }
            if (ok) break;
            while (t[i][n - 1] != '#') {
                op2(2, n - 1);
            }
            op2(1, i);
        }
    }
    clean2();
    while (true) {
        bool ex = false;
        for (int i = 0; i < n; ++i) {
            if (t[i][n - 1] == '#') {
                ex = true;
                break;
            }
        }
        if (!ex) break;
        while (t[cnt_s / (n - 1)][n - 1] != '#') {
            op2(2, n - 1);
        }
        op2(1, cnt_s / (n - 1));
    }
    if (cnt_s % (n - 1)) {
        while (t[cnt_s / (n - 1)][0] != '#') {
            op2(1, cnt_s / (n - 1));
        }
    }

    reverse(res2.begin(), res2.end());
    cout << "Yes" << endl;
    cout << res1.size() + res2.size() << endl;
    for (auto [x, y] : res1) {
        cout << x << " " << y + 1 << endl;
    }
    for (auto [x, y] : res2) {
        cout << x << " " << y + 1 << endl;
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3500kb

input:

3
.#.
#.#
.#.
#.#
...
#.#

output:

Yes
15
1 3
2 3
1 1
1 1
2 3
2 3
1 2
1 2
2 3
1 2
1 1
1 1
1 3
2 3
2 3

result:

ok AC

Test #2:

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

input:

3
.#.
#.#
.#.
.#.
#.#
.#.

output:

Yes
13
1 3
2 3
1 1
1 1
2 3
2 3
1 2
1 2
1 2
1 1
2 3
1 3
1 3

result:

ok AC

Test #3:

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

input:

13
.............
....#####....
......#......
......#......
......#......
......#......
.............
....#...#....
....#...#....
....#...#....
....#...#....
.....###.....
.............
....####.....
....#...#....
....####.....
....#........
....#........
.............
.....###.....
....#...#....
......

output:

No

result:

ok AC

Test #4:

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

input:

3
#.#
#.#
###
#.#
.#.
###

output:

No

result:

ok AC

Test #5:

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

input:

4
.#..
.#..
....
...#
....
..#.
#...
....

output:

No

result:

ok AC

Test #6:

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

input:

4
....
....
....
.#..
..##
##.#
####
..##

output:

No

result:

ok AC

Test #7:

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

input:

2
..
..
..
..

output:

Yes
0

result:

ok AC

Test #8:

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

input:

3
.##
##.
.#.
##.
..#
.##

output:

Yes
14
2 3
2 3
1 3
1 3
1 1
1 2
2 3
2 3
1 2
1 1
2 3
2 3
1 1
1 3

result:

ok AC

Test #9:

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

input:

3
...
#..
..#
...
#..
#..

output:

Yes
12
1 2
1 2
2 3
1 1
2 3
1 1
1 1
2 3
1 1
2 3
1 2
1 3

result:

ok AC

Test #10:

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

input:

3
..#
.##
###
#.#
.##
#.#

output:

Yes
10
1 2
1 2
1 2
1 2
1 2
1 1
2 3
1 2
1 3
1 3

result:

ok AC

Test #11:

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

input:

4
....
#...
...#
#.#.
#...
....
.#..
.##.

output:

Yes
34
1 4
2 4
2 4
1 4
1 4
2 4
2 4
2 4
1 2
1 2
1 2
1 1
2 4
1 1
2 4
1 1
2 4
2 4
1 2
1 2
1 2
1 2
1 1
2 4
1 1
1 1
1 3
1 3
2 4
2 4
1 4
2 4
1 4
1 4

result:

ok AC

Test #12:

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

input:

4
#.#.
##..
....
#..#
....
...#
.#.#
#.##

output:

Yes
25
2 4
1 4
1 4
1 4
1 1
1 1
2 4
2 4
1 2
1 2
2 4
1 2
2 4
1 2
1 3
1 3
1 4
1 4
1 1
2 4
1 1
2 4
1 1
1 4
2 4

result:

ok AC

Test #13:

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

input:

2
.#
.#
#.
#.

output:

Yes
2
1 1
1 2

result:

ok AC

Test #14:

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

input:

3
##.
.##
...
...
#..
###

output:

Yes
11
1 2
1 2
1 2
1 2
1 1
2 3
1 1
1 3
2 3
1 3
2 3

result:

ok AC

Test #15:

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

input:

3
.#.
##.
.#.
#.#
..#
#..

output:

Yes
10
1 3
2 3
1 1
1 1
1 2
2 3
1 2
1 1
1 1
1 3

result:

ok AC

Test #16:

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

input:

3
#.#
#..
#..
.#.
.##
.#.

output:

Yes
11
1 3
1 3
1 1
2 3
2 3
1 2
1 2
1 1
2 3
1 3
1 3

result:

ok AC

Test #17:

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

input:

4
####
#..#
...#
.#..
....
.##.
###.
#.##

output:

Yes
32
1 4
1 4
1 2
2 4
1 2
2 4
2 4
1 3
2 4
1 3
1 3
1 3
2 4
2 4
1 3
1 2
1 3
2 4
1 3
1 1
2 4
1 1
2 4
1 1
1 3
2 4
2 4
1 4
1 4
2 4
1 4
2 4

result:

ok AC

Test #18:

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

input:

4
.#.#
##..
.#.#
.##.
#.#.
..##
#.#.
#..#

output:

Yes
37
1 4
2 4
2 4
1 4
1 1
2 4
1 1
1 1
2 4
1 3
1 3
2 4
1 2
2 4
2 4
1 3
2 4
1 3
1 3
1 3
2 4
1 3
1 2
2 4
1 2
1 3
1 3
2 4
2 4
1 1
1 1
1 3
2 4
2 4
2 4
1 4
2 4

result:

ok AC

Test #19:

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

input:

19
.######.######..###
...###.##.###.#####
.#.####..#.##...###
.#####.##.######.##
.##.#############..
.#.....##..#.##.#.#
#####.###..#.###.##
#.####.#...##..#.##
.######.##.##..####
.#.###.###.###..###
#######.###.#..###.
#####.###.####.##.#
..#.######..###..#.
#.#.#..####..###.#.
########.####..##...

output:

No

result:

ok AC

Test #20:

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

input:

21
#####################
#####################
#####################
#####################
#####################
#####################
#####################
#########.###########
#####################
#####################
#####################
#####################
#####################
###########...

output:

No

result:

ok AC

Test #21:

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

input:

26
##.###....#######.....#...
.#.##.#####..#..#..###.###
.#.#####.##.##.#.#.##.#..#
###.###...##...#.#....#.#.
.##..###..#.##.#.##..#.#.#
#..##...##.#...####...####
##.#..###.#.####...###....
.##..#..##.##..#.##...#.##
####.###..#.#####..#####..
.#.#.##..###.###..###.####
##.##.#..#..#....###..###.
...

output:

No

result:

ok AC

Test #22:

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

input:

35
####.##.###.####..##.##############
####.####.##############.######.###
###########..######.###.######.###.
#.#.####.##.#####...###############
################.#####.############
#######...#.####.###..######.######
#.##.#############.####.######.#.##
##..####.####.#####################
#####.##....

output:

Yes
2992
1 35
1 35
1 35
1 35
1 35
1 35
1 35
1 35
1 35
1 35
2 35
1 35
1 35
1 35
1 35
1 35
1 35
1 35
1 35
2 35
1 35
1 35
1 35
1 35
1 35
1 35
1 35
1 35
2 35
1 35
1 35
1 34
1 34
1 34
2 35
1 34
1 34
1 34
1 34
2 35
1 34
2 35
1 34
1 34
1 34
1 34
1 34
1 34
1 34
2 35
1 34
2 35
1 34
1 34
1 34
1 34
2 35
1 34
1...

result:

ok AC

Test #23:

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

input:

34
.........#.................#......
...#.#............................
..........#.............#.........
.................................#
.......#..........................
..................................
.......................#..........
.................#................
....................

output:

Yes
1222
1 34
1 34
2 34
1 34
1 34
1 34
1 34
1 34
1 34
1 34
1 34
2 34
1 34
1 34
1 34
1 34
1 34
1 34
1 34
1 34
1 34
2 34
1 34
1 34
1 34
1 34
1 34
1 34
2 34
2 34
1 34
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
2 34
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 33
1 32
1 32
2...

result:

ok AC

Test #24:

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

input:

23
####.####.#.#.#########
..####.##.##.###.######
#.###...#.#.###.###.###
###.#####.####..#######
#.#...##.######..#.#.##
.####.##.###########..#
##.#....##..###.#.#..##
##.#.####...##.###..#.#
##.###..###########.###
###.###..###.#.#.#.##.#
#.####.###..##.#####..#
###.######.##.####..#.#
.###.####...

output:

Yes
1469
1 23
1 23
1 23
1 23
2 23
1 23
2 23
2 23
1 23
1 23
1 23
2 23
1 23
1 23
2 23
2 23
1 23
2 23
2 23
1 23
1 23
1 23
1 23
1 23
2 23
2 23
1 23
2 23
1 23
1 23
1 22
1 22
1 22
2 23
1 22
1 22
1 22
1 22
1 22
1 22
2 23
1 22
1 22
1 22
2 23
1 22
1 22
1 22
2 23
1 22
1 22
1 22
1 22
1 22
2 23
1 22
1 22
1 21
1...

result:

ok AC

Test #25:

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

input:

20
#....###......##...#
.......##...#...#..#
......#.....#.#.....
..#....##.#..#.#....
#..#...#.#...##.#...
...#...#...##.....#.
#####.#........#....
....##...#.#..#.....
.#.#........#....#..
.#.#.###...#........
#.....#..##.##......
##....##..#.........
.#.#..............#.
#..............#..#.
##....

output:

Yes
1067
1 20
1 20
1 20
2 20
1 20
2 20
1 20
1 20
1 20
1 20
1 20
1 20
1 20
2 20
1 20
1 20
1 20
2 20
1 20
1 20
1 20
1 20
2 20
1 20
1 19
1 19
1 19
1 19
1 19
1 19
1 19
1 19
2 20
1 19
1 19
2 20
1 19
2 20
1 19
2 20
1 19
1 19
1 19
1 19
1 19
1 19
1 18
2 20
1 18
1 18
1 18
1 18
1 18
1 18
1 18
1 18
1 18
1 18
1...

result:

ok AC

Test #26:

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

input:

12
##..#.......
.#.##.###.#.
##.#..#.####
##.###..###.
.#.#.##.#.##
##.###.#...#
#..###..####
..####.#####
#.#.##.##.#.
.#.##.####..
.#.....#####
###.#..##.#.
.##.#######.
..###.#.####
#.###...##..
.#...##.#.##
.#.#########
#...##.#.##.
.##.##...##.
..####.#.###
...#.#######
..#.......#.
..#.#..##.#...

output:

Yes
428
2 12
1 12
1 12
2 12
2 12
2 12
1 12
1 12
1 12
2 12
1 12
2 12
1 12
1 12
1 11
1 11
1 11
1 11
1 11
2 12
2 12
1 11
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 12
1 1
1 1
1 1
2 12
1 1
2 12
2 12
2 12
2 12
2 12
2 12
2 12
2 12
1 11
2 12
1 11
2 12
1 11
1 2
2 12
1 2
1 2
2 12
1 2
2 12
1 2
2 12
1 2
1 2
2 12
1 2
2 12
1...

result:

ok AC

Test #27:

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

input:

44
###...##.#....##.#####.##.##...####.##....##
#.#...##..#.#.##..#.###.......####..#..#..#.
..#.########..##.#.....##.....#..##...#.#.#.
#.#.##.#.#.#.#....#.#.######.#....#......###
#.#.#.##...##.#..#.#..#######.#.###..###.###
###..#...#...#........##..#...#.##..#..#..##
..##.#..#..#####......#..##...

output:

Yes
6417
2 44
2 44
1 44
2 44
1 44
1 44
1 44
1 44
1 44
2 44
2 44
2 44
1 44
1 44
2 44
2 44
2 44
1 44
2 44
1 44
1 44
2 44
1 44
2 44
2 44
1 44
1 44
1 44
2 44
2 44
2 44
2 44
1 44
2 44
2 44
1 44
2 44
1 44
1 44
1 44
1 44
1 44
2 44
1 44
1 44
2 44
1 44
1 44
1 44
2 44
1 44
1 44
1 44
1 44
1 44
1 44
1 44
2 44
2...

result:

ok AC

Test #28:

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

input:

10
##...#.#.#
###....###
#####.#...
....#....#
....#..##.
.#.#..##.#
##.##.#...
#..#..##.#
##..#.#.#.
######.#.#
..###.#.#.
...####...
.....#.###
####.####.
####.##..#
#.#.##..#.
..#..#.###
.##.##..#.
..##.#.#.#
......#.#.

output:

Yes
277
2 10
1 10
1 10
2 10
2 10
1 10
1 10
2 10
2 10
1 10
2 10
2 10
1 10
1 1
2 10
1 1
1 1
2 10
1 1
1 1
2 10
1 1
2 10
1 1
2 10
2 10
2 10
2 10
2 10
1 10
2 10
1 10
2 10
1 10
1 9
2 10
1 9
1 9
1 2
1 2
1 2
2 10
1 2
2 10
1 2
2 10
1 2
2 10
2 10
2 10
2 10
1 9
1 9
2 10
1 9
1 9
1 9
2 10
1 9
1 8
1 8
1 3
2 10
1 ...

result:

ok AC

Test #29:

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

input:

44
..#.#.###.#.....#...#.#####.....#....#.#....
####.....#..##...##..#.####.#.#..#..#..#####
#.###.##########.##.#####..#####.#.##....#.#
#..#.##.##..###..#...#.....###.##..##.#.##..
.####.#..##.###.#.###....#..#..######...#.#.
##...#.#.##.##..#.##.####.###.#..#####.#.###
.#..####...##.####.....##.....

output:

Yes
6356
1 44
2 44
1 44
2 44
1 44
1 44
2 44
1 44
2 44
2 44
1 44
2 44
2 44
1 44
2 44
2 44
2 44
2 44
1 44
1 44
1 44
2 44
1 44
1 44
1 44
2 44
2 44
1 44
2 44
1 44
2 44
2 44
1 44
2 44
2 44
1 44
1 44
2 44
1 44
2 44
1 44
2 44
1 44
2 44
2 44
1 44
1 44
1 44
2 44
1 44
1 44
2 44
1 44
1 44
2 44
1 44
2 44
2 44
2...

result:

ok AC

Test #30:

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

input:

10
###..#...#
#.##.##..#
#..#..##.#
..#..###..
#..###...#
.##.##.##.
.##..##...
#.###.##..
.#####....
.#...#.#.#
...##.###.
.#..#..##.
.##.##..#.
##.##...##
.##...###.
#..#..#..#
#..##..###
.#...#..##
#.....####
#.###.#.#.

output:

Yes
280
2 10
1 10
1 10
2 10
1 10
1 10
2 10
1 10
1 10
1 10
1 10
1 9
1 9
1 9
1 9
2 10
2 10
1 9
1 1
2 10
1 1
2 10
1 1
2 10
1 1
1 1
2 10
1 1
2 10
2 10
2 10
2 10
1 9
2 10
1 9
2 10
1 9
1 8
1 8
2 10
1 8
1 2
2 10
1 2
2 10
1 2
1 2
1 2
2 10
1 2
1 2
1 2
2 10
2 10
2 10
1 8
1 8
2 10
1 8
2 10
1 8
2 10
1 8
1 8
1 3...

result:

ok AC

Test #31:

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

input:

30
..#.#..#....##.#..###...##.#..
..###...#####.#..##.##......##
..###.#.####.....#...##..##.#.
#.#....####.#..##...##..###..#
#.##.#.........#.##.#.##......
#.##......##..#.######..##..##
###..#.##..##...#####.##..##.#
#####.#..#...###.....##..#.#.#
##..#.####.####....####......#
##.#..####.#..##.....

output:

Yes
2916
1 30
1 30
1 30
2 30
1 30
1 30
1 30
2 30
1 30
2 30
1 30
2 30
2 30
2 30
2 30
2 30
2 30
2 30
1 30
1 30
1 30
1 30
2 30
1 30
1 30
2 30
1 30
2 30
1 30
1 30
2 30
1 30
2 30
2 30
2 30
2 30
1 30
2 30
1 30
2 30
1 30
1 30
1 30
1 30
2 30
2 30
2 30
2 30
2 30
1 30
1 30
2 30
2 30
1 30
1 30
1 30
2 30
1 29
1...

result:

ok AC

Test #32:

score: 0
Accepted
time: 11ms
memory: 3728kb

input:

79
###########.#####.#.###################################################.######.
#####.#########.##.###.##.#.######.############.####.##.###########.##..#######
#########.##..########.###.###.##########..################.#########.####.###.
#####.####..##.#####.#.###.######.######################....

output:

Yes
14632
1 79
1 79
2 79
2 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
2 79
1 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
...

result:

ok AC

Test #33:

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

input:

79
..........##...............#..#.#...#...#.....##...............................
..#...#......#.........#..##...#.#....##.##.........##.#...#...#......#..##....
.##....#.........#........#...............#....#......#.......#....#..#....#...
...#...##...##...#...#.#.....................#.#............

output:

Yes
15426
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
1 79
...

result:

ok AC

Test #34:

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

input:

79
.......#..##.#.........#....#....#..#..#.........#.#...........#...............
..#.................#............#...........................#........#.#....#.
#........................#........#........#..................#..##...........#
....#...##.................#......##........................

output:

Yes
14040
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
...

result:

ok AC

Test #35:

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

input:

79
....................#..........................................................
.............#..#..#.........#............#...............................#....
.......................................................#.......................
.........................#....#......................#.#....

output:

Yes
10067
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
...

result:

ok AC

Test #36:

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

input:

79
...#####...######.#####.###...####.#.##.#.#....#..##..########.##.##.#.####..##
.##..##.####.#####.##.#######.####..#####..#..#.#####.#...####.#######.#..###.#
#..####.#.#####.###.####..##..##.#.#####..#.###..#..#....#.####..###.##.###.#.#
.##.####.####..######.###..##.#########.#.##.##.#####.......

output:

Yes
19173
1 79
1 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
2 79
1 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
1 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
1 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
2 79
2 79
2 79
1 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
1 79
2 79
1 79
2 79
1 79
...

result:

ok AC

Test #37:

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

input:

79
######.#####.##.....#..##.##.##.##.###.#####..#####.#.#######.##.#.###.#.###.#.
...#.....##.....#...#...#.####....#.#.#.######..#..####.#.#######.###..###.###.
.#.#....##.....##.###.#####...#......#.#..#.#..###.#######.#.##...##..###.#..#.
.##.#.#..##.#...###.##....##......#..#....##.##.#.#.#...#...

output:

Yes
20453
1 79
1 79
2 79
1 79
1 79
2 79
1 79
2 79
2 79
2 79
1 79
2 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
1 79
2 79
2 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
1 79
...

result:

ok AC

Test #38:

score: 0
Accepted
time: 12ms
memory: 4016kb

input:

79
..#.#..###.##.#.#.####.#.##.#..#....#...#######.#...#...#....#####..##..##.####
#.#..####.#.#.#..#..#.#....##...#.#..#..#.###.#.#.#.#.....####.####.#..#.#.###.
#...#...#.##.#..##.#####.#.#####.......#######...###.#.#...#.###.####.####..##.
#.##.#..#......##...#.##..#..###.##..#..###..#.##.....##....

output:

Yes
20505
1 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
2 79
1 79
2 79
2 79
2 79
1 79
2 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
2 79
1 79
2 79
2 79
1 79
2 79
2 79
...

result:

ok AC

Test #39:

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

input:

79
....#.#.##..#.#...........########..#..#..###########.###..#..####.#.###.#.....
.#..#...#...#.#####.#..##.#.#.#.#...#.##.##.#..##..##########....##.###.####.##
..###..#..###.....#..##..#.....##..##.###....##..####..##..##..#####.#####....#
#.#######..###..###.##.#.#..###########.##..#....#.#.#..#...

output:

Yes
20487
1 79
2 79
1 79
2 79
1 79
2 79
2 79
2 79
1 79
2 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
2 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
...

result:

ok AC

Test #40:

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

input:

79
###..#.#.#...##.##.###...#.####.####...#....#..#...###...#.#..#...#.#.#.##..#..
#####.###....#.#....#.####...#..###..#..#.##.##...#.###..#.#...####.####....#..
##.....#####.#..#.....#.#.#..#.#..#.############..#.#.#...#....#.###.#...##.##.
#.#...#.########..##....#####...##...#.#.#.#..#.#...##......

output:

Yes
20505
2 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
2 79
2 79
2 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
2 79
1 79
2 79
1 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
...

result:

ok AC

Test #41:

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

input:

79
.....###.##.#.#....####.#.###..#.###..#.##...###.##..#.##.#.####......#.###.#..
###.##..###.######.#.##..####.#####.#.#.####..#.##..######..#...#.##....###...#
#...##.####.#..#####..#####.##.#...####.#...####..##.##.#..####....#...#....###
####..###..#.##.......#...#..##.####.##.###...#####.#..#....

output:

Yes
20443
2 79
1 79
2 79
2 79
1 79
2 79
2 79
1 79
2 79
1 79
1 79
1 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
2 79
2 79
1 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
...

result:

ok AC

Test #42:

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

input:

79
..##.##.#..#.#.#.#..##.#.....#.#####...####.####..###..##..#....##.#.#...#....#
.###.#.####.###.###..#.#.#.#...#.#####...##..#.##..##..#.####..###.#.##.#.#.###
.##..###..##....#.#..#.#.##.#.##.###..#####.#..#.#.##.####...##....#.###..###..
#..##..###.#.###.###.##.######.#.#........##...##.##..#.#...

output:

Yes
20552
1 79
2 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
1 79
2 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
1 79
2 79
1 79
1 79
1 79
...

result:

ok AC

Test #43:

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

input:

79
...##...#..##......##..##....###....#.##..##.##.##..#.#..#.#..##...#........#..
####.#.#.#.#.###....#..#.##.....#.#.###.#.#.#.#...#.#####..##..###.##.#.#######
..#.#.#...#####.#####.#.##..#.#.#..###.##...##.#.#..#...#####.###..##...##..###
.#....#...#..##......#..##....#..##.#..#.##.###..##...#.#...

output:

Yes
20504
1 79
2 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
2 79
2 79
1 79
2 79
1 79
1 79
2 79
1 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
2 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
1 79
...

result:

ok AC

Test #44:

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

input:

79
#....#.##.###.....##.#####.#.#..##..#.######.#.###.#.######.#.##.#......#..#.##
.###.##.##......#..###.#.#....#....##.###.#.###.#......#...##..##..##...#.##...
.##.#..##...##...#.#....#...#...##..#.#.#.#...#.#.##...#.###..##.#####..#.#####
..###..#.###......#..#...###..#......###..##.....####..##...

output:

Yes
20453
1 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
2 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
1 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
1 79
...

result:

ok AC

Test #45:

score: 0
Accepted
time: 11ms
memory: 3784kb

input:

79
...#..####..##.#.#..#.....#..#.####...#.#..#.#....#..#..#.###.#####...#....#.##
..##......##.#.##..#.#.###..####.#.##.#.......##..##.....#.#.#####....#..###.#.
#..#.##.#.#.##..##.####..########.##.#.#..####.#####.##.######.##.#..####..##.#
##...#....##....####.#.#.#..#...##########.###.###.#..###...

output:

Yes
20543
1 79
1 79
2 79
1 79
2 79
1 79
2 79
1 79
2 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
2 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
2 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
1 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
1 79
1 79
2 79
1 79
2 79
2 79
1 79
...

result:

ok AC

Test #46:

score: 0
Accepted
time: 11ms
memory: 3996kb

input:

79
#...##..#.##..#.#.###..##.###.#####..#.#...###......#..#...#..######.#.#..#.#.#
#..#.##...#.###.#..#...#####.#.#.#...##..##.###..###..####..#.#.#..####.##.#..#
###..#.##..##.###..###.#.##..#..##....##.#..####.##.##..###..#..#.....#..#.##..
.#.#.....##...#.##..###.##.##.##..#..###.##...#.#.#####.#...

output:

Yes
20564
2 79
1 79
2 79
1 79
2 79
2 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
1 79
2 79
2 79
2 79
2 79
2 79
2 79
2 79
1 79
1 79
2 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
1 79
2 79
1 79
2 79
1 79
1 79
1 79
1 79
2 79
2 79
2 79
1 79
2 79
2 79
1 79
2 79
1 79
1 79
2 79
1 79
2 79
1 79
2 79
2 79
...

result:

ok AC

Test #47:

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

input:

80
##..#..#.#.##.######.####.##...#..#####.#..#.#####.##...#.####.##.##.#.#...#.#..
#.###.#.#.#...#.#...#.#.#.###....#.##.###..#....##.####.##.#####.####.##.##..#..
.###.##.###.##.####..#####..#####.###.#####.##....##.#.#.#..#####.#...###.#.##.#
#.###.###..##.#.##.##...###.#.####...##.###.#...##.#.#...

output:

Yes
20570
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
2 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
1 80
...

result:

ok AC

Test #48:

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

input:

80
.....#.##...#.#.###.......#..#.#...#..###.#.#..#..#.#...###......####..#.#.#..##
##..##...#.....##.#....###.#..#......###.#...#.##.....#.#.##..##...#....#.......
#.#.#..#.#.##..........#..............##..#.#..###.##..#.###...#......#.#...##..
....#...##.##.#.#.......#...#.#.##.#...#.###..#.#...##...

output:

Yes
19960
2 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
1 80
2 80
1 80
2 80
2 80
2 80
1 80
2 80
1 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
2 80
2 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
...

result:

ok AC

Test #49:

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

input:

80
###..####..############.########.########.###.########.#####.###.##.######..####
.#####.#.#####.###.######.###..##.################.###.#.#######################
########.#####.######..##.##.####.#.#####.#.#.###..#########...######.##.#######
##.############.#..#.##..########.####..####..#.######...

output:

Yes
15413
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
...

result:

ok AC

Test #50:

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

input:

80
#.###.##..#..##############.#.###..#######.#####.####.###.######...######.######
#.##...#.####.#.###..#.#####.####.#.#.######.#####.#...###.##..##.#.####.##..###
#####################.#..#####.######.###.####.##############.####.###.##.##.#.#
##.##.#.###.##..#####.###########.##.#.#.#.##..#.###.#...

output:

Yes
18380
2 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
2 80
2 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
1 80
...

result:

ok AC

Test #51:

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

input:

80
#####..##.###..###..##.#......#..####.##.####.#####.##.####.###.###..#..#.####..
####...######.#####.##.######..#####..####..#######.#..###########.#..##..#.####
.#..#..##..##..#..#.#.#####..##.#######.##.###..####.###.###..#.#.###.#######.##
.#.###.########..###.#.#.#####.###..##...####..#..###....

output:

Yes
18123
2 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
...

result:

ok AC

Test #52:

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

input:

80
##.#..#####...####.#.....#.#.#....##...#.....##...##....#..##....###.....#.##.#.
##.#...#..##.#####...#..#.......#..#..#.###.###########.###.#.##.##.##.########.
...##.##.#..###...###.#.###.#.##.#####..#.....##.####..##.#.####.#######.###.###
....#.##..#.##...##..##.##....#.#...###.#.##..##.##......

output:

Yes
21136
2 80
2 80
2 80
1 80
2 80
2 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
2 80
2 80
2 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
...

result:

ok AC

Test #53:

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

input:

80
.#..#.####..##.#..##...#.#..#.#.#...#.#####.#..##....#.####.#.####.##.#.#...#..#
.#.#...#....#.##.###..#.###..#.#.#.#...####.#..#..##...####..##..##..#.##.#..###
...##.#..###...#....#..###..#.#..##.#.#..#.##.####....###..#.######....#.#..####
...##..##...#.#...##...##.#.####.#...###..#...#####.##...

output:

Yes
21241
2 80
2 80
1 80
2 80
2 80
1 80
2 80
2 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
2 80
2 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
...

result:

ok AC

Test #54:

score: 0
Accepted
time: 11ms
memory: 4060kb

input:

80
####...####.#.#..####.....###...#.#.#......#..##.###.###.#.#.#...#..###.#...#..#
#...#.#..#.###.#.#.####..###..#.#...#.##.#...##.#..##..#..##.#.####.#..##..##.#.
#.########.###...#..##..##..######..#.#.#.###..##..#.#.#.###.#.###...#.####..###
#.##.#.####..####.#..##.###.##.##......#..##....###.##...

output:

Yes
21202
2 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
2 80
2 80
2 80
2 80
1 80
2 80
1 80
2 80
1 80
2 80
1 80
2 80
2 80
2 80
2 80
2 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
2 80
2 80
1 80
2 80
2 80
1 80
2 80
2 80
2 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
2 80
1 80
2 80
2 80
...

result:

ok AC

Test #55:

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

input:

80
#..#..........###.#...#.######..###...###..####.#..#.####.##.###..##....#..#.##.
###..##.#.#.###......#####...#.##.#.#..#.....###.#...##.#.##.#......#.#..###...#
####.##...#.###..###.####..#.#.###.####..#.##.###.#.#..##.##.##....##...#.#...##
##.#.#..#.###....##..####.#......#####....##.#.##.#.##...

output:

Yes
21323
1 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
2 80
2 80
2 80
1 80
1 80
2 80
2 80
2 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
...

result:

ok AC

Test #56:

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

input:

80
.#..#...#...##...#....##.#.#.###....##.#.#..#.#.#......#####.#.##.#.#...#.###...
#..######.##.####..####..##..#####.##.....#.##...###.##.##.#....#.######....###.
#.#.#.##..##.#..#...##...###.#....#.######.#####....#.#..#.####..#....##..#...##
#.#####.##.#.....#.##.###.#####.#########.####.##....#...

output:

Yes
21275
1 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
1 80
2 80
1 80
2 80
2 80
2 80
1 80
2 80
2 80
2 80
2 80
2 80
2 80
1 80
2 80
2 80
1 80
2 80
2 80
2 80
1 80
1 80
2 80
2 80
2 80
1 80
2 80
1 80
...

result:

ok AC

Test #57:

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

input:

80
#.#.#....#.#.#......##.##..#.##...##.##..#######..#####..##.#....####.##.##.##..
...####...#.###...#.#........#.##....#...##..##...#.#########..#.#...##....#.#..
..#..#.###..#.#..###.##.###..##..####.#..##.#.##..#...#...##.....###.#....###.#.
##.######..#...###.##.####.#.#..##.#.##....#..#..#...#...

output:

Yes
21284
1 80
2 80
2 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
2 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
2 80
2 80
1 80
...

result:

ok AC

Test #58:

score: 0
Accepted
time: 11ms
memory: 3992kb

input:

80
...###.#.#..#....##.##....#.####.####..########.##..#####.##.#..##..##.#...#.#.#
#.#.....#.##...#.##..#..#...#..###.###.########.##....#..##..#.#.#.#.##.........
#..##...#.##.#.#.##...##.......###...##..#...##..####.####.##.##..#.##....#####.
#.##..##..#.#.#..#..##.#...##.##.#.....#....#.#.##..#....

output:

Yes
21329
2 80
1 80
2 80
1 80
2 80
2 80
2 80
2 80
2 80
1 80
2 80
1 80
2 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
2 80
2 80
2 80
2 80
2 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
...

result:

ok AC

Test #59:

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

input:

80
###..#.#..#.#.#.#.##.####..##.##......###.##..##.#.#....####....###.#....###.#.#
#######.#.##...##.....####.##...###..#.#..###..###.#..###.#.......#....#.#.#....
###.#.#.##...#...##.....###.##.#...#..###.#...###.##.#.##..#.#..#.#....######..#
#.#..##.#.######.#...##.#..#...#.#..#..#...#..##.#...#...

output:

Yes
21194
1 80
2 80
1 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
2 80
2 80
2 80
2 80
2 80
1 80
2 80
2 80
1 80
2 80
2 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
2 80
2 80
1 80
2 80
2 80
2 80
2 80
2 80
2 80
1 80
1 80
...

result:

ok AC

Test #60:

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

input:

80
##.##..##....#..#.#...#####....#.####....#.....#..####...#.##.#..#..#######..##.
.######.####..#.#####.##.....#.####....#.###.....##.#.#.#....#.##.#.#.###.##....
###.#..#.##.#.##.##.#.#.##.....##..#...#...#.#.##.#####.#....#..#..#.###.#.#.#.#
#..#..##..#.##..#..#.###.#.###..#...####.##....####......

output:

Yes
21322
1 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
1 80
1 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
2 80
2 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
2 80
2 80
1 80
2 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
...

result:

ok AC

Test #61:

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

input:

80
.#.##..####..#.#..#.##.##.##..#..#############..###.######.#.#..##.##....##.##.#
....#...##.#.####..#.##..#....#...#.#..##..##.###.######.###..#.#.####.#......#.
....##...###.#.#..#.#....#...#.#####..###.#.##...###.......#.####.####....#..##.
..###.#....##..#.#..#.#.##..###..#.##..##..#.####.#.##...

output:

Yes
21123
2 80
1 80
2 80
2 80
1 80
2 80
2 80
2 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
2 80
1 80
1 80
2 80
2 80
2 80
1 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
2 80
1 80
2 80
2 80
1 80
1 80
1 80
2 80
1 80
1 80
2 80
1 80
2 80
1 80
1 80
1 80
2 80
2 80
1 80
1 80
2 80
2 80
1 80
2 80
2 80
2 80
2 80
1 80
2 80
...

result:

ok AC

Test #62:

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

input:

5
...##
##...
#.#.#
#.#.#
#.#..
###..
..###
.#...
.#.#.
.#.##

output:

Yes
56
1 5
1 5
2 5
2 5
2 5
1 5
1 5
1 1
1 1
2 5
1 1
2 5
1 1
2 5
1 4
1 4
2 5
1 4
1 4
1 2
2 5
1 2
2 5
2 5
1 3
2 5
1 3
1 3
1 3
2 5
1 3
1 3
2 5
1 3
1 2
2 5
1 2
1 4
1 4
2 5
2 5
1 1
1 1
1 1
1 1
1 4
1 4
2 5
2 5
1 5
1 5
2 5
2 5
1 5
1 5
2 5

result:

ok AC

Test #63:

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

input:

5
###.#
.#...
#..#.
#..##
.#..#
...#.
#.#.#
.##.#
.##..
#.##.

output:

Yes
53
2 5
2 5
1 5
1 5
1 5
1 4
1 1
2 5
2 5
2 5
1 4
1 4
1 4
1 2
2 5
1 2
2 5
1 2
1 2
2 5
2 5
1 3
1 3
2 5
1 3
1 3
1 3
1 3
2 5
2 5
1 3
1 2
1 2
2 5
1 2
1 2
1 4
2 5
1 4
1 4
1 1
2 5
1 1
2 5
1 1
1 5
2 5
2 5
2 5
1 5
1 5
2 5
1 5

result:

ok AC

Test #64:

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

input:

5
..##.
..#.#
.....
#....
....#
#....
.....
.#...
..#..
.#.##

output:

Yes
44
1 4
1 4
1 4
1 4
2 5
1 2
1 2
1 1
1 1
1 1
2 5
1 1
2 5
2 5
2 5
1 2
2 5
1 2
1 2
1 2
1 2
2 5
1 2
1 1
2 5
1 1
2 5
1 1
1 1
1 3
1 3
2 5
2 5
1 4
1 4
1 4
2 5
2 5
1 5
1 5
2 5
1 5
1 5
2 5

result:

ok AC

Test #65:

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

input:

5
.#...
.....
.#.##
.....
.....
.....
.....
..##.
...#.
#....

output:

Yes
32
2 5
1 3
2 5
1 3
1 3
2 5
1 1
2 5
1 1
2 5
1 1
1 1
1 1
2 5
2 5
1 1
2 5
1 1
2 5
1 1
1 3
2 5
2 5
2 5
1 3
1 3
1 3
1 4
1 4
1 4
1 4
1 5

result:

ok AC

Test #66:

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

input:

5
...##
##.#.
.....
#.#.#
#.##.
...#.
.#..#
###.#
#..##
.#...

output:

Yes
63
1 5
2 5
2 5
1 5
2 5
1 5
1 5
1 1
1 1
2 5
1 1
2 5
1 1
2 5
1 4
1 4
2 5
1 4
1 4
1 2
1 2
2 5
2 5
1 3
2 5
1 3
2 5
1 3
1 3
1 3
2 5
1 3
2 5
2 5
2 5
1 3
1 3
2 5
2 5
1 2
2 5
1 2
1 2
2 5
1 2
1 3
2 5
1 3
2 5
2 5
1 4
1 4
1 4
1 1
2 5
1 1
2 5
1 1
1 4
2 5
2 5
1 5
1 5

result:

ok AC

Test #67:

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

input:

5
#.#..
###.#
.##.#
.#...
..#..
#...#
##..#
....#
#..##
.##..

output:

Yes
50
1 5
1 5
1 4
1 4
1 4
2 5
2 5
1 3
1 3
1 1
2 5
1 1
1 1
2 5
1 3
2 5
1 2
2 5
2 5
1 3
2 5
1 3
2 5
1 3
1 3
1 3
2 5
1 3
2 5
1 3
1 2
2 5
1 2
1 2
1 2
1 4
1 4
1 4
2 5
2 5
1 4
1 5
1 1
2 5
1 1
2 5
1 1
1 1
1 5
1 5

result:

ok AC

Test #68:

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

input:

6
##....
##.#.#
.###..
#..#.#
.###..
##..#.
..####
..#.#.
#...##
.##.#.
#...##
..##.#

output:

Yes
91
1 6
2 6
1 6
1 6
1 6
2 6
2 6
1 6
2 6
1 5
1 5
1 1
2 6
1 1
2 6
1 1
2 6
2 6
1 5
2 6
1 5
1 4
1 4
1 2
2 6
1 2
1 2
2 6
1 4
1 4
1 4
2 6
1 3
2 6
1 3
1 3
1 3
1 3
2 6
2 6
1 4
2 6
1 4
2 6
1 4
1 4
1 4
1 4
2 6
1 4
2 6
1 4
1 3
2 6
1 3
2 6
1 3
1 3
1 4
1 4
2 6
1 4
2 6
1 4
1 4
2 6
2 6
1 2
1 2
2 6
1 2
2 6
1 2
1...

result:

ok AC

Test #69:

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

input:

6
.##.##
##....
..#...
.##.#.
.##..#
###.##
#..#..
..####
##.###
#..#.#
#..##.
...#..

output:

Yes
86
2 6
2 6
1 6
2 6
1 6
1 6
2 6
1 6
1 1
1 1
2 6
1 1
1 1
1 1
2 6
2 6
2 6
2 6
1 6
1 5
1 5
1 5
1 2
2 6
1 2
2 6
1 2
2 6
1 5
1 4
2 6
1 4
1 4
1 3
2 6
1 3
2 6
1 3
1 3
2 6
1 3
1 4
1 4
2 6
2 6
1 4
2 6
1 4
1 4
1 4
1 4
2 6
1 4
2 6
1 4
1 3
1 3
1 3
1 2
2 6
1 2
1 4
1 4
1 4
2 6
1 4
2 6
2 6
1 5
1 1
1 1
2 6
1 1
2...

result:

ok AC

Test #70:

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

input:

6
......
......
......
......
......
......
......
......
......
......
......
......

output:

Yes
0

result:

ok AC

Test #71:

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

input:

6
###..#
##....
..#..#
#.#.##
.#.#.#
.#.###
##.#..
##..#.
.##.#.
.##...
#.###.
#.###.

output:

Yes
85
1 6
1 6
1 6
2 6
1 6
1 6
1 5
2 6
1 5
1 5
2 6
2 6
1 5
1 5
1 1
1 1
1 1
2 6
1 1
2 6
1 1
2 6
1 4
1 4
2 6
1 4
1 4
1 2
1 2
1 2
1 2
2 6
1 2
2 6
2 6
1 3
1 3
1 3
2 6
2 6
1 4
2 6
1 4
1 4
1 4
1 4
1 4
2 6
1 4
1 3
1 3
2 6
2 6
1 3
2 6
1 3
1 3
1 4
2 6
1 4
1 4
1 4
2 6
2 6
1 2
1 2
1 2
2 6
1 2
2 6
1 2
1 4
2 6
2...

result:

ok AC

Test #72:

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

input:

6
.#..#.
#.####
...###
##....
#.####
#.#...
.##.#.
.###.#
#.##.#
#.#...
###..#
.##...

output:

Yes
94
2 6
1 6
2 6
2 6
1 6
2 6
1 6
1 6
1 1
2 6
1 1
1 1
1 1
2 6
2 6
2 6
1 5
1 5
1 5
1 5
1 4
1 2
2 6
1 2
2 6
1 2
2 6
1 2
1 2
1 4
2 6
1 4
2 6
1 3
2 6
1 3
2 6
2 6
2 6
1 4
2 6
1 4
1 4
1 4
1 4
1 4
2 6
1 4
1 3
2 6
2 6
1 3
1 3
2 6
1 3
1 4
2 6
1 4
1 4
2 6
2 6
1 2
2 6
1 2
2 6
1 2
1 2
1 4
1 4
2 6
2 6
1 5
2 6
1...

result:

ok AC

Test #73:

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

input:

6
.#####
.##..#
##.##.
......
##..##
....#.
...#..
####..
.###..
###.#.
..##.#
....##

output:

Yes
82
1 6
2 6
1 5
2 6
1 5
1 5
1 5
1 1
1 1
1 1
1 1
1 1
2 6
2 6
2 6
2 6
1 5
1 2
2 6
1 2
2 6
1 2
1 2
1 2
2 6
2 6
1 3
1 3
1 3
2 6
2 6
1 4
2 6
1 4
1 4
1 4
1 4
1 4
2 6
1 4
2 6
1 3
1 3
1 3
1 3
2 6
1 3
1 2
1 2
1 2
1 2
1 2
1 4
1 4
2 6
1 4
2 6
1 4
1 1
1 1
2 6
1 1
2 6
1 1
2 6
1 1
1 4
2 6
2 6
1 5
2 6
1 5
1 5
1...

result:

ok AC

Extra Test:

score: 0
Extra Test Passed