QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#181802#2773. Replicate Replicate RfplicbteSwarthmore#AC ✓62ms4520kbC++175.2kb2023-09-17 00:46:192023-09-17 00:46:19

Judging History

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

  • [2023-09-17 00:46:19]
  • 评测
  • 测评结果:AC
  • 用时:62ms
  • 内存:4520kb
  • [2023-09-17 00:46:19]
  • 提交

answer

#include "bits/stdc++.h"
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef DEBUG
#define dbg(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << endl;
#else
#define dbg(x...)
#endif


const int MOD = 1000000007;
const char nl = '\n';
const int MX = 310; 

int cur[MX][MX], nxt[MX][MX];

void solve() {
    int N, M; cin >> N >> M;
    FOR(i, 5, M+5) {
        FOR(j, 5, N+5) {
            char C; cin >> C;
            if (C == '#') {
                cur[i][j] = 1;
            }
        }
    }

    while (true) {
        int bi = -1, bj3 = -1;
        F0R(i, MX) {
            int cnt[3]; F0R(j, 3) cnt[j] = 0;
            F0R(j, MX) {
                cnt[j%3] ^= cur[i][j];
            }
            if (cnt[0] == cnt[1] && cnt[0] == cnt[2]) continue;
            if (bi != -1) {
                goto done;
            }
            bi = i;
            F0R(j, 3) {
                if (cnt[j] != cnt[(j+1)%3] && cnt[j] != cnt[(j+2)%3]) {
                    bj3 = j;
                }
            }
        }

        int bj = -1, bi3 = -1;
        F0R(i, MX) {
            int cnt[3]; F0R(j, 3) cnt[j] = 0;
            F0R(j, MX) {
                cnt[j%3] ^= cur[j][i];
            }
            if (cnt[0] == cnt[1] && cnt[0] == cnt[2]) continue;
            if (bj != -1) {
                goto done;
            }
            bj = i;
            F0R(j, 3) {
                if (cnt[j] != cnt[(j+1)%3] && cnt[j] != cnt[(j+2)%3]) {
                    bi3 = j;
                }
            }
        }
        //dbg(bi, bj, bi3, bj3);

        if (bi != -1 || bj != -1) {
            if (bi == -1 || bj == -1) goto done;
            if (bi % 3 != bi3 || bj % 3 != bj3) goto done;
            cur[bi][bj] ^= 1;
        }
        int cnt = 0;
        F0R(i, MX) F0R(j, MX) nxt[i][j] = 0;
        FOR(i, 2, MX) {
            FOR(j, 2, MX) {
                nxt[i][j] = cur[i-1][j-1];
                F0R(a, 3) {
                    F0R(b, 3) {
                        if (a != 0 || b != 0) {
                            nxt[i][j] ^= nxt[i-a][j-b];
                        }
                    }
                }
                cnt += nxt[i][j];
            }
        }

        if (cnt == 0) {
            if (bi != -1) {
                cur[bi][bj] ^= -1;
            }
            goto done;
        }
        F0R(i, MX) F0R(j, MX) cur[i][j] = nxt[i][j];
    }

    done:
    ;
    int lx = MX, hx = -1, ly = MX, hy = -1;
    F0R(i, MX) {
        F0R(j, MX) {
            if (cur[i][j]) {
                ckmin(lx, i); ckmax(hx, i);
                ckmin(ly, j); ckmax(hy, j);
            }
        }
    }
    //dbg(lx, hx, ly, hy);
    FOR(i, lx, hx+1) {
        FOR(j, ly, hy+1) {
            cout << (cur[i][j]?'#':'.');
        }
        cout << nl;
    }

}
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
//    cin >> T;
    while(T--) {
        solve();
    }

	return 0;
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 4436kb

input:

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

output:

.#
##

result:

ok 2 lines

Test #2:

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

input:

8 8
##..#.##
#.####.#
.#.#.#..
.##.#.##
.#.#.#..
.##.#.##
#..#.###
##.#.##.

output:

####
#..#
#.##
###.

result:

ok 4 lines

Test #3:

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

input:

5 4
#....
..###
..###
..###

output:

#

result:

ok single line: '#'

Test #4:

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

input:

1 1
#

output:

#

result:

ok single line: '#'

Test #5:

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

input:

3 3
###
###
###

output:

#

result:

ok single line: '#'

Test #6:

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

input:

3 3
.##
###
###

output:

#

result:

ok single line: '#'

Test #7:

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

input:

3 3
##.
###
###

output:

#

result:

ok single line: '#'

Test #8:

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

input:

3 3
###
###
.##

output:

#

result:

ok single line: '#'

Test #9:

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

input:

3 3
###
###
##.

output:

#

result:

ok single line: '#'

Test #10:

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

input:

3 3
.##
###
##.

output:

.##
###
##.

result:

ok 3 lines

Test #11:

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

input:

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

output:

####
#..#
#..#
####

result:

ok 4 lines

Test #12:

score: 0
Accepted
time: 14ms
memory: 4472kb

input:

88 79
...##......##...#.....#............##......##...#.....#............##......##...#.....#.
..#..#....#..#..##...##...........#..#....#..#..##...##...........#..#....#..#..##...##.
.#....#..#......#.#.#.#..........#....#..#......#.#.#.#..........#....#..#......#.#.#.#.
.######..#......#..#..#.......

output:

...##......##...#.....#.
..#..#....#..#..##...##.
.#....#..#......#.#.#.#.
.######..#......#..#..#.
.#....#..#......#.....#.
.#....#...#..#..#.....#.
.#....#....##...#.....#.
........................
###....##...####.....##.
.#....#..#..#...#...#..#
.#...#......#...#..#....
.#...#......####...#....
...

result:

ok 15 lines

Test #13:

score: 0
Accepted
time: 14ms
memory: 4408kb

input:

88 79
...##......##...#.....#............##......##...#.....#............##......##...#.....#.
..#..#....#..#..##...##...........#..#....#..#..##...##...........#..#....#..#..##...##.
.#....#.#.#......#..#.#.........#.#...#..#.......#..#.#.###......#....#..#......#.#.#.#.
.######.#.#......###..#.......

output:

...##......##...#.....#.
..#..#....#..#..##...##.
.#....#..#......#.#.#.#.
.######..#......#..#..#.
.#....#..#......#.....#.
.#....#...#..#..#.....#.
.#....#....##...#.....#.
........................
###....##...####.....##.
.#....#..#..#...#...#..#
.#...#......#...#..#....
.#...#......####...#....
...

result:

ok 15 lines

Test #14:

score: 0
Accepted
time: 34ms
memory: 4472kb

input:

171 168
..#.....#.........#.....#.........#.....#.........................#.....#.........#.....#.........#.....#.........................#.....#.........#.....#.........#.....#..
...#...#...........#...#...........#...#...........................#...#...........#...#...........#...#...................

output:

..#.....#..
...#...#...
..#######..
.##.###.##.
###########
#.#######.#
#.#.....#.#
...##.##...

result:

ok 8 lines

Test #15:

score: 0
Accepted
time: 29ms
memory: 4348kb

input:

171 168
..####.#.#.....####....#.#.###....#.....#.........................####.#.#.....####....#.#.###....#.....#.........................####.#.#.....####....#.#.###....#.....#..
....##..##.....###.#....##.###.....#...#............................##..##.....###.#....##.###.....#...#...................

output:

..#.....#..
...#...#...
..#######..
.##.###.##.
###########
#.#######.#
#.#.....#.#
...##.##...

result:

ok 8 lines

Test #16:

score: 0
Accepted
time: 27ms
memory: 4476kb

input:

172 165
.##......................................#.......................##......................................#.......................##......................................#..
#####.................................######....................#####.................................######..............

output:

.##......................................#..
#####.................................######
#######..............................###.###
###..####...........................##....##
#####..###........................###.....##
#####...###......................###......##
.####....####....................

result:

ok 37 lines

Test #17:

score: 0
Accepted
time: 27ms
memory: 4344kb

input:

172 165
.##......................................#.......................##......................................#.......................##......................................#..
#####.................................######....................#####.................................######..............

output:

.##......................................#..
#####.................................######
#######..............................###.###
###..####...........................##....##
#####..###........................###.....##
#####...###......................###......##
.####....####....................

result:

ok 37 lines

Test #18:

score: 0
Accepted
time: 27ms
memory: 4388kb

input:

187 181
.............................#...............................................................#...............................................................#.............................
............................###.............................................................###............

output:

.............................#.............................
............................###............................
............................###............................
...........................#####...........................
...........................#####...........................
...

result:

ok 53 lines

Test #19:

score: 0
Accepted
time: 27ms
memory: 4340kb

input:

187 181
.............................#...............................................................#...............................................................#.............................
............................###.............................................................###............

output:

.............................#.............................
............................###............................
............................###............................
...........................#####...........................
...........................#####...........................
...

result:

ok 53 lines

Test #20:

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

input:

300 300
#.#..#.##.##.##.#..##.#.#...#.##.#.#.#.#.#####..###...######.#...#.#..####.#.##.##.#.#...#.##..#....##.#####.##..#......#....###..##....#######......##.#..#..####..#.#...###.#....###...#..#.#..##..#..##.#..#..#.#....#.#...##..##.#..###..#.#...#...##....#.#.#.##.#.....##...##....##..#..#.###....

output:

#.#..#.##.##.##.#..##.#.#...#.##.#.#.#.#.#####..###...######.#...#.#..####.#.##.##.#.#...#.##..#....##.#####.##..#......#....###..##....#######......##.#..#..####..#.#...###.#....###...#..#.#..##..#..##.#..#..#.#....#.#...##..##.#..###..#.#...#...##....#.#.#.##.#.....##...##....##..#..#.###...##..#....

result:

ok 300 lines

Test #21:

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

input:

300 300
.##.....#.#..###.#.######..#.##.##.##.####.#...#..#.#.#..#.##..#.#....########.#..#.#.#...##..#..##.#.##.....##..###..####..#..####...#.####.#...#####..##...#..#..#...#.###...##..#.#.#.##....###...#####..........#.#.##.###..##.#..#.###.#########.##.#.#.#.####..#.##.##.###.#.#######..#.###.##...

output:

.#.##.###....#...########.#.#...#.#...#..###.###.#.#.#.###..##...##.##########....###.....#.###.#...####.##.#....#....#..##....#..##.#.#..#.#.##..#..##..##.#.###.#.##...#.....#.###...####.##..#.##..#..##.##.##.###...#.#..##..###.#.#..###########..###...######.#.#...#.#..###..#..#....#####..###.##.
....

result:

ok 298 lines

Test #22:

score: 0
Accepted
time: 58ms
memory: 4476kb

input:

299 299
###.###.###.....###.###.###..#..#.#.#.#.###..#...#...#.......................#...#...#.......#...#...#.......................#..#.#.#.#.###..#..#.#.#.#.###..#..#.#.#.#.###..................#...#...#.......#...#...#.......................#...#...#.......#..#.#.#.#.###.....###.###.###.....###....

output:

#

result:

ok single line: '#'

Test #23:

score: 0
Accepted
time: 61ms
memory: 4456kb

input:

300 300
#.#.#.#.###..#..###.#.#.#.#.....###.###.###.....................................................................................#.#.#.#.###..#..###.#.#.#.#.....###.###.###.....................................................................................#.#.#.#.###..#..###.#.#.#.#.....###....

output:

#.
.#

result:

ok 2 lines

Test #24:

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

input:

300 300
..............................................................#...#...#.......................#...#...#.......................................................#...#...#.......................................................#...#...#.......................#...#...#................................

output:

..............................................................#.....................................
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #25:

score: 0
Accepted
time: 42ms
memory: 4364kb

input:

300 300
...................................#...#...#.......................#...#...#.......................................................#...#...#.......................................................#...#...#.......................#...#...#...........................................................

output:

...................................#................................................................
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #26:

score: 0
Accepted
time: 41ms
memory: 4320kb

input:

264 212
...............................................................#...#...#.......................#...#...#.......................................................#...#...#.......................................................#...#...#.......................#...#...#
..............................

output:

...............................................................#
................................................................
................................................................
................................................................
#..........................................

result:

ok 12 lines

Test #27:

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

input:

296 300
.........................###.###.....###.###.....###.###.###.....###.###.....###.###.....###.###.....###.###.....###.###.###.....###.###.....###.###.....###.###.....###.###.....###.###.###.....###.###.....###.###...................................................................................

output:

.........................................#......................................................
................................................................................................
................................................................................................
............

result:

ok 84 lines

Test #28:

score: 0
Accepted
time: 42ms
memory: 4464kb

input:

300 300
####....########################....####........................................................############........................####....####################....####........................############........................................................####....########################...

output:

####################################################################################################
####################################################################################################
##################################################################################################...

result:

ok 100 lines

Test #29:

score: 0
Accepted
time: 42ms
memory: 4412kb

input:

300 300
####....########################....####........................................................############........................####....####################....####........................############........................................................####....########################...

output:

####################################################################################################
####################################################################################################
##################################################################################################...

result:

ok 100 lines

Test #30:

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

input:

300 300
###....................................................................................................................................................................................................................................................................................................

output:

#

result:

ok single line: '#'

Test #31:

score: 0
Accepted
time: 42ms
memory: 4416kb

input:

300 300
...................................................................................................#...#...#.......................#...#...#.......................................................#...#...#.......................................................#...#...#.......................#...

output:

...................................................................................................#
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #32:

score: 0
Accepted
time: 42ms
memory: 4324kb

input:

300 300
...................................................................................................#...#...#.......................#...#...#.......................................................#...#...#.......................................................#...#...#.......................#...

output:

...................................................................................................#
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #33:

score: 0
Accepted
time: 42ms
memory: 4388kb

input:

300 300
............................................................................##.#.##.........##.#.###...#...###.#.##................#...#...#.......................................................#..##...#..........#...............................#............#...#...#..........#............#...

output:

...................................................................................................#
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #34:

score: 0
Accepted
time: 42ms
memory: 4456kb

input:

300 300
#...#...#.......................#...#...#.......................................................#...#...#.......................................................#...#...#.......................#...#...#..............................................................................................

output:

#...................................................................................................
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #35:

score: 0
Accepted
time: 42ms
memory: 4316kb

input:

300 300
#...#...#.......................#...#...#.......................................................#...#...#.......................................................#...#...#.......................#...#...#..............................................................................................

output:

#...................................................................................................
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #36:

score: 0
Accepted
time: 42ms
memory: 4512kb

input:

300 300
#...#...#.......................#...#...#.........##.#.##.##.#.##.##.#.##.......................#...#...#.....................................................##..##..##........................#...#...#.....................###.###.###.....................................................###.##...

output:

#...................................................................................................
....................................................................................................
.....................................................................................................

result:

ok 100 lines

Test #37:

score: 0
Accepted
time: 58ms
memory: 4460kb

input:

299 299
.##.#.##.........##.#.##.........##.#.##.........................................................................................##.#.##.........##.#.##.........##.#.##.........................................................................................##.#.##.........##.#.##.........##....

output:

#

result:

ok single line: '#'

Test #38:

score: 0
Accepted
time: 58ms
memory: 4456kb

input:

299 299
###.#.....#.##......###.#.#.....###.#.#.#.#..........#...#...#.......#...#...#.......................#...#...#.......#...#...#..###.#.....#.##......#.#.###..#..###.###.###..#.......#...#...#.......................#...#...#.......#...#...#..................###.##...##.#.......#.#.###..#..###....

output:

#

result:

ok single line: '#'

Test #39:

score: 0
Accepted
time: 61ms
memory: 4384kb

input:

299 299
###.###.###.....###.###.###.....###.###.###.....................................................................................###.###.###.....###.###.###.....###.###.###.....................................................................................###.###.###.....###.###.###.....###....

output:

#

result:

ok single line: '#'

Test #40:

score: 0
Accepted
time: 62ms
memory: 4380kb

input:

299 299
###.###.###.....###.###.###.....###.###.###.....................................................................................###.###.###.....###.###.###.....###.###.###.....................................................................................###.###.###.....###.###.###.....###....

output:

#

result:

ok single line: '#'

Test #41:

score: 0
Accepted
time: 61ms
memory: 4460kb

input:

299 299
####.#..#...#....#.#.##.#.###..##....###.##......#...#......##..#.#.##....##.####.#..###.##.##.##.###.#.##.####.##.....#..#...#...#...####.#....#.#..##.#.....#.#.#..#.##.##..##.#######...###..#.######...#..##.#.....#.#..#.#...#..##.#.##......#.####.......##...#...#.##..#.#..##..#......#.#.#....

output:

#

result:

ok single line: '#'

Test #42:

score: 0
Accepted
time: 61ms
memory: 4456kb

input:

299 299
##...#..#.#.#..#.....#.##..##.#..#...#.#.#.########.........##..#.#.####.#####.###.##......##.##..#.##.#..#....###....#.#..##.....#..###...###.######..#.####..#.###..#########.##..##.##..##...#.#.#.....####.#...#...###.##...###..#####.....#.##...###.##.##..#..##.##.##..#.####..#.#..##.#####....

output:

#

result:

ok single line: '#'

Test #43:

score: 0
Accepted
time: 62ms
memory: 4384kb

input:

299 299
###.###.###.....###.###.###.....###.###.###.....................................................................................###.###.###.....###.###.###.....###.###.###.....................................................................................###.###.###.....###.###.###.....###....

output:

#

result:

ok single line: '#'

Test #44:

score: 0
Accepted
time: 62ms
memory: 4408kb

input:

299 299
#####.#.###.#..##.###.#.#.#..#..#.#..#..##..#.#.#.#..#.#.#.#..#.###.##.####.##.##.#.##....#.###..#######..##..#.##....#.#...#....#######.#.##..#.#####.###.#.#...###.#..#.#......#..##..###......#####..#.......###..#..###.....##...#...##.....#.#.....#...........#...##.###..#.###.#.###.....###....

output:

#

result:

ok single line: '#'

Test #45:

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

input:

1 300
#
.
.
.
.
.
.
.
#
.
.
.
.
#
#
#
.
.
.
#
#
#
#
#
.
#
.
#
.
.
#
.
#
.
#
#
#
#
.
#
.
#
.
.
.
.
.
.
.
.
.
#
.
.
.
#
#
.
.
.
.
.
#
.
#
#
.
#
#
#
#
#
#
#
.
.
.
#
#
#
.
#
.
.
#
#
#
#
.
#
#
.
.
#
.
.
#
#
#
.
#
.
#
#
.
.
.
.
#
.
#
.
.
.
.
#
.
.
#
#
.
#
#
.
.
.
#
.
.
#
#
.
#
.
#
.
.
.
#
.
#
.
.
#
#
.
.
...

output:

#
.
.
.
.
.
.
.
#
.
.
.
.
#
#
#
.
.
.
#
#
#
#
#
.
#
.
#
.
.
#
.
#
.
#
#
#
#
.
#
.
#
.
.
.
.
.
.
.
.
.
#
.
.
.
#
#
.
.
.
.
.
#
.
#
#
.
#
#
#
#
#
#
#
.
.
.
#
#
#
.
#
.
.
#
#
#
#
.
#
#
.
.
#
.
.
#
#
#
.
#
.
#
#
.
.
.
.
#
.
#
.
.
.
.
#
.
.
#
#
.
#
#
.
.
.
#
.
.
#
#
.
#
.
#
.
.
.
#
.
#
.
.
#
#
.
.
.
.
.
...

result:

ok 300 lines

Test #46:

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

input:

2 300
#.
.#
..
#.
.#
#.
.#
#.
##
..
.#
##
#.
#.
#.
.#
.#
#.
#.
##
##
##
##
#.
#.
..
.#
..
.#
.#
.#
..
#.
.#
..
..
..
.#
#.
##
.#
##
#.
#.
..
..
.#
##
##
##
.#
##
..
#.
##
.#
#.
.#
..
..
.#
#.
##
#.
#.
.#
.#
##
#.
..
##
..
.#
#.
..
..
##
..
.#
#.
..
..
#.
..
#.
#.
#.
.#
..
##
##
..
#.
.#
#.
..
.#
.#
...

output:

#.
.#
..
#.
.#
#.
.#
#.
##
..
.#
##
#.
#.
#.
.#
.#
#.
#.
##
##
##
##
#.
#.
..
.#
..
.#
.#
.#
..
#.
.#
..
..
..
.#
#.
##
.#
##
#.
#.
..
..
.#
##
##
##
.#
##
..
#.
##
.#
#.
.#
..
..
.#
#.
##
#.
#.
.#
.#
##
#.
..
##
..
.#
#.
..
..
##
..
.#
#.
..
..
#.
..
#.
#.
#.
.#
..
##
##
..
#.
.#
#.
..
.#
.#
##
##
...

result:

ok 300 lines

Test #47:

score: 0
Accepted
time: 31ms
memory: 4384kb

input:

151 300
##.#.##.##.#.##.##.#.##.........................................##.#.##.##.#.##.##.#.##.........................................##.#.##.##.#.##.##.#.##
##.#.##.##.#.##.##.#.##.........................................##.#.##.##.#.##.##.#.##.........................................##.#.##.##.#...

output:

#
.
#
.
#
#
#
#
.
.
#
.
.
#
.
.
#
.
#
.
.
#
#
#
#
.
.
#
#
.
.
.
.
#
.
#
.
.
.
#
#
#
.
#
#
#
.
.
.
#
#
.
.
#
.
.
.
#
#
#
.
#
#
#
#
.
#
#
.
.
.
#
.
.
#
#
#
#
#
.
.
.
#
.
#
.
#
.
#
.
#
#
.
#
#
#
.
.
#
.
.
#
.
#
#
.
.
.
#
#
.
.
#
.
.
#
#
#
.
.
#
#
#
.
.
#
#
.
.
#
.
.
.
#
#
.
.
#
#
.
#
#
#
#
.
#
#
#
.
#

result:

ok 150 lines

Test #48:

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

input:

300 1
#..#.....###...#.#.#...#############.#.#...#.#...#....#.#....#.......#.#...####.#.####.#....#.#.#........#....#.##....##.#..#....##..##...#..######..###########...#.####.#.#.###.##..##......#..#......###.###.####..#.#..#.####.#.....#.#.#..#...#.#.######....##.########.##.....####.####..#.#.##....

output:

#..#.....###...#.#.#...#############.#.#...#.#...#....#.#....#.......#.#...####.#.####.#....#.#.#........#....#.##....##.#..#....##..##...#..######..###########...#.####.#.#.###.##..##......#..#......###.###.####..#.#..#.####.#.....#.#.#..#...#.#.######....##.########.##.....####.####..#.#.##.#.#..#

result:

ok single line: '#..#.....###...#.#.#...#######...##.....####.####..#.#.##.#.#..#'

Test #49:

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

input:

300 2
#..##..#.#.#..##.####.#...#.##.####...#.####.##..##...#.#.....#.##.....##...#.#.#.#.#...#...###.#...###......######.##.##...###..#..#..#..#.#.###.#.##.#...#.#.##.#####..#..#....#.#.##....##.##....#.###.####....#####.#......#..##..#.#..#.##.##..#####.#.....#..##...###...#.#..#..##..##.........#...

output:

#..##..#.#.#..##.####.#...#.##.####...#.####.##..##...#.#.....#.##.....##...#.#.#.#.#...#...###.#...###......######.##.##...###..#..#..#..#.#.###.#.##.#...#.#.##.#####..#..#....#.#.##....##.##....#.###.####....#####.#......#..##..#.#..#.##.##..#####.#.....#..##...###...#.#..#..##..##.........#.....#...

result:

ok 2 lines

Test #50:

score: 0
Accepted
time: 31ms
memory: 4508kb

input:

300 151
###...#.##.#####..##.###.##.####.....#...#.##.#.#.#.#.##.#..#..#...####..#..#.###...#.#.####....##...#.#.#.#.#....#..###...###..#...##....##.#.##.##.###..#.#....#.##...#.#..#....#..###...###...##.###.###.#.#.#........#...###.#.###..#######.#...##...#.#.#.##..#..#..######...####.###.##...#..#...

output:

#.#....#...###..#.##...#.##.###..##.......#.####.#..#.#.....#..##..#####.#######.#.####..#..###..#.##.#...##.##........####.##.##.#.##.###...###..##.#

result:

ok single line: '#.#....#...###..#.##...#.##.##...####.##.##.#.##.###...###..##.#'

Test #51:

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

input:

35 23
#..#.#.#.#.#.##..###.##.###...##..#
#..#.#.#.#.#..##..##..###.#..##..##
###.....###......#..#..............
.###.#.##.##..####.#..###.#.#....##
..###.##.#.#.##..#..#.......###....
.#..###.###..#.#..##..###.#.#....##
#..#.#.#.....#####..#.#.###...##..#
##.##.###.#.#.####.###.............
.#..##...

output:

####.#.######

result:

ok single line: '####.#.######'

Test #52:

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

input:

40 19
.............###.....###.....###........
.............###.....###.....###........
.............###.....###.....###.##.#.##
.................................##.#.##
........................................
#.#.#.........#.#...#...#.#......##.#.##
........................................
#.#.#.....

output:

#

result:

ok single line: '#'

Test #53:

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

input:

44 31
..#..........#.......##..#...##..##...#..##.
...#...##.#.....#..##..##.#.#......##..#..#.
....#....#.....#.#.###...#.#.#.....###.#....
......#...#.#.#.##...#..#....##.#.#.###..#..
....#.###.#.#.##.###.###..#..###.....#...##.
....#..##.##....#......##.....###.###..#..##
...#..####..#..#.#..####...

output:

#...#...#..#...##.
.#....#.#.#.##..#.
..#...##..##.#....
....#.....#.#..#..
.#...#.....##.....
#....##.##...#...#
#...#....#..##....

result:

ok 7 lines

Test #54:

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

input:

12 18
.##.##.##.##
.#....#.####
#.#.##.#.#..
#...##.###..
...###...###
.....######.
...#.##.####
.###..##.##.
.....##.#.##
#.####....#.
.##..#..#.##
###.##....##
#..#..#..#..
#.#..#.#.##.
.#....#.####
#.###..#...#
#...##.###..
.##...##..#.

output:

.###.###
.#.#..##
####..##
########
#..#####
#.#.#.#.
.#######
..###.##
###..###
...##.##
########
###.####
#.#.##..
.####.#.

result:

ok 14 lines

Test #55:

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

input:

42 21
#.....###...#.##...##.#.##.##..###.#...#.#
.#.......#...#.#..#.#...#..####..#.......#
###....##.#....####.##..#.###.##..#.......
#.#..#..#.....###...####..#.#.##....##....
.#..##......#..#..#.##...#.#..###...#...#.
....#.#...#...#.###.##.###.##.##..........
.....#.#.#.......###.###.###...........

output:

#.....##....#...#..#...#.#
.#...........#.#.........#
###....#.#........#.......
#.#..#....#..###....##....
.#..#..#............#...#.

result:

ok 5 lines

Test #56:

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

input:

17 34
##.##.###.##.##..
##.##.###.##.##..
..#.#...#...#.#..
.................
..#.#...#...#.#..
##.##.###.##.##..
##.##.###.##.##..
.................
..#.#...#...#.#..
##.#.#.#.#.##....
##.#.#.#.#.##....
....###.###.###..
####..##..####...
....###.###.###..
..#..##..##..#...
....###.###.###..
##.##....

output:

#
.
.
#
.
#
.
.
.
#
.
#
.
.
#

result:

ok 15 lines

Test #57:

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

input:

32 40
......#.##.####.##.##..##.#.#.##
.###..#.##.###.#.......#.##.###.
.###....##...#.###....#.##....#.
...#######.####..##.#...#.#.##..
#.###.#....#..###.#.#.#...###.##
#...#.##.###...#.###.##.#...##.#
..##...###.#...###.#.##.#..#.###
#.#..#.....###.##.##....#.#...##
#.#.#.#....###.##.######.#.#.....

output:

......##.....#...#
.#.#.#...#.#.##.##
........#..#.#.#.#
...#.#...#........
#...#.#.#.#.#.#.##
..##..#.#..#...##.
..........#.#..###
...#.###....#.####
..#.##......#...##
##.#..........###.
.#..#..#....#..#.#
...##.....#.#.#.#.
.##.#.#........#..
...#.#.##.#..#..#.
....##.##.#...#..#
..#....#..#.......

result:

ok 26 lines

Test #58:

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

input:

25 17
#.......#.......#........
................#...#...#
.........................
.........................
.........................
................#...#...#
.........................
.........................
#.......#.......#........
................#...#...#
.........................
...........

output:

#

result:

ok single line: '#'

Test #59:

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

input:

15 24
##.##.###.##.##
##.##.###.##.##
...............
##.##.###.##.##
##.##.###.##.##
...............
##.##.###.##.##
##.##.###.##.##
.#.##.###.##.##
...............
##.##.###.##.##
##.##.###.##.##
...............
##.##.###.##.##
##.##.###.##.##
...............
...............
...............
.........

output:

#

result:

ok single line: '#'

Test #60:

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

input:

25 21
..................###....
....#.............###....
.......##.#..#.#.###.###.
......#.######....##.#.#.
..#.#.#.#.######.###.##..
..#.#....#.#.#...#.####..
.##..#...##.##..#....###.
#..##..##.......##.#.###.
..##.####.########.###...
#.######.##..##.######.#.
.#.#.......###...#..###..
.##..#.....

output:

.......#....####.#
......#........##.
..##.#.....##..#..
...........##...##
.#..#..##.#.#.....
#.......#.#...##..
#.#.......#.......
...###...##......#
##....#....#......
.##...............
..#.#...#.#...#...
......#.......#.#.
........#.....####

result:

ok 13 lines

Test #61:

score: 0
Accepted
time: 19ms
memory: 4412kb

input:

227 106
...##.#.##.##.#.###.####.###.#.##.#.####.#.##.#.###.####.###.#.#.####..##...##....###..#.###.#.#.##...##..####.##.####.#.##.#.####.#.##.#.####.##.####.#.##.#.##.........##.#.##.##.#.##.##.#.##...................................
..#.####.##.####.#.##.#.####.#.##..##.#.###.####.#.##.#.####.##....

output:

...#..............#.............................................#........................................#...............................
..#...........................................................#..............................................................#...........
...........................

result:

ok 20 lines

Test #62:

score: 0
Accepted
time: 29ms
memory: 4408kb

input:

222 274
.#.##.####..###.####.#.####.#.........#####.#.##.#...#.######...##..##.#.##.#.###.##..#...#...........#####.#.##.#...#.######...##..##.#.##.#.###.##..#...#...........#####.#.##.#...#.######...#..#.##.#.#..#.#.#...#####..#.
.#.#.#..#####.########.#..##..#.#.###..#..#....#...#........##..###.#...

output:

.######.#..###########..#.###.#.#.#..#...##.##.##.##...#.#.#####.....####..#.#...##.
....#..#.....#.#.#.###.##..#...###....###..##..#...#.#..##...#.#...##..##.#.#..##.#.
##########....#....#.....###....#.#..#..##....#..#...##..######.##...##..##...###...
#..#..##.#.......##.###.#....##.#..##.#.....#...

result:

ok 136 lines

Test #63:

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

input:

228 282
...........#.#.##.#.#.#.#..#.#.#..#........#.#####.#.#......#...######....####.#..#######..#######.....#...####.#..##....####.####...#...#.####.#...#####....#.#.#.#.#.........#.#....#.####.#.#.#.#..###.#..#.#.#.#..######...#.#.#
#.#...##.####.##.#.##...#.#.###..#...##.##.#..#.##.##.###.#.##....

output:

...........#....#.....#...#.#.......#.........#..#..........#.........#....#.....#.##.#.............#.......#..#....#..#...........#.........#.........#.................#............##.......#
#...#..##.....##....#..#.....#...#..#...##........##...#.#.......###.......#..#.#.......#...#......#..........

result:

ok 233 lines

Test #64:

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

input:

102 184
.##..###.....#.##.#..#.....#....#.#...#....#..####..#####.###...###.##..#.#.##.####.#.#.#.#.###.###...
#...#.#.#.####..##.#...##..##..##.##.#...#.##.##..##..###..##.##..#..#..#.#####..#.....#.#####...#..##
#.#.#.####.##....##.#..##.........#.....######.####.#######.#.###......##.##..####..#....

output:

.#.##.#.#..##..#.##........#....#.#.#..#.#.#..##........#...
#.....#.#...#.##.#...#...#.........##...#..#......#......#.#
..##.#...#......#....#..#....##...........#..##....#....#...
..###....##......#.##....#.#.....#..........######.....#....
.............#...#...#.....##..........##..#....#..##.##...

result:

ok 142 lines

Test #65:

score: 0
Accepted
time: 25ms
memory: 4468kb

input:

253 190
............................#.#.#...........#.#.#...........................#.#.#...........................#.#.#...........#.#.#............................................................................................................................
.........................................

output:

.......................................................#
........................................................
........................................................
........................................................
........................................................
#.................

result:

ok 6 lines

Test #66:

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

input:

156 102
......#...#.......#...#.......#...#...#.......#...#.......#...#..............#...#......##..##......##..##...#..#...##..##......##..##......#...#...........
.............................................................#...#.......#...#.....#.#.#.#...#.......#...#.......#.#.#.#..................

output:

......#......................................................................#..........#...........
.............................................................#.....................#...........#....
.....................#.................#...............................#.............................

result:

ok 46 lines

Test #67:

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

input:

57 214
#.#.#...#.#.#...........#.#.#...........#.#.#...#.#.#....
.........................................................
#.#.#...#.#.#...........#.#.#...........#.#.#...#.#.#....
.........................................................
#.#.#...#.#.#...........#.#.#...........#.#.#...#.#.#....
......

output:

#....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
....#
....#
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
.....
...#.
.....
.....
.....
.....
.....
.....
.....
.....
#....
.....
.....
.....
...

result:

ok 162 lines

Test #68:

score: 0
Accepted
time: 13ms
memory: 4380kb

input:

227 207
...........................................................................##.#.##.........................##.#.##.........................##.#.##...........##.##.##.##.##.##.##.##.##.##.###.##.##.##.##.##.##.##.##.##.##.......
...................................................................

output:

...........#.#...#....#..#.##.#......#..#.........#....#.#..#...#.....#..#...####...................#........#....#.#....#..##..#.#.....
...#.....#..............#.#....#.#....#...#................##.......##.....................#....#..#....#..#..#.#.....#...#..#.....#...#
##...#.............#.....#...

result:

ok 103 lines

Test #69:

score: 0
Accepted
time: 9ms
memory: 4456kb

input:

267 96
.........................................................................................................................................#.#.#.............................................................................................................................
............................

output:

..........#.......#....................#............................................................#.................#.............................................................#.....#..##....................#..
.....................................##...........#.#......#......#............#........

result:

ok 13 lines

Test #70:

score: 0
Accepted
time: 33ms
memory: 4520kb

input:

283 234
...........................................................................................#.........#.....#.........#.....#.........#.....................#.........#.....#.........#.....#.........#.....................#.........#.....#.........#.....#.........#.....................
...........

output:

...........................................................................................#.........#.....................
.........................#.................................................................................................
.................#.....................................

result:

ok 74 lines

Test #71:

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

input:

76 49
.......................................#.#...#...#.#........................
............................................................................
.......................................#.#...#...#.#........................
..................................................................

output:

#

result:

ok single line: '#'

Test #72:

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

input:

57 57
...............##.#.##...................................
...............##.#.##...................................
.........................................................
...............##.#.##...................................
.....##.##.##.##.##.#.##.##.##.##.##.....................
.......

output:

#

result:

ok single line: '#'

Test #73:

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

input:

74 61
....................#.#...#...#.#.........................................
..........................................................................
....................#.#...#...#.#.........................................
........................................................................

output:

#

result:

ok single line: '#'

Test #74:

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

input:

70 57
............................................##.#.##...................
............................................##.#.##...................
......................................................................
......#.....................................##.#.##...................
.............

output:

#

result:

ok single line: '#'

Test #75:

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

input:

56 49
......##.####...#.#.....#.#...####..#......#.......#....
......##.####..####..#..###..####..###.#................
...........#.#.#...#.#.#...#.#.#........................
......##.####..####..#..###..####..###.#................
......##.####...#.#.....#.#...####.##...................
....###.#...

output:

#

result:

ok single line: '#'

Test #76:

score: 0
Accepted
time: 21ms
memory: 4408kb

input:

263 231
.................................................................###...................................................................................................................................................................................................
...............................

output:

#.#
...
#.#

result:

ok 3 lines

Test #77:

score: 0
Accepted
time: 21ms
memory: 4344kb

input:

242 219
...................................................................................................................................................................###.###.....###.....###.###....................................................
....................................................

output:

#.#
...
#.#

result:

ok 3 lines

Test #78:

score: 0
Accepted
time: 21ms
memory: 4480kb

input:

260 239
.................................................................................................................................................................................................................................................................###
..................................

output:

#.#
...
#.#

result:

ok 3 lines

Test #79:

score: 0
Accepted
time: 21ms
memory: 4344kb

input:

243 238
....................................................................###.###.###....................................................................................................................................................................
...................................................

output:

#.#
...
#.#

result:

ok 3 lines

Test #80:

score: 0
Accepted
time: 21ms
memory: 4468kb

input:

236 258
.........................................................................................................#...#...#..........................................................................................................................
..........................................................

output:

#.#
...
#.#

result:

ok 3 lines

Test #81:

score: 0
Accepted
time: 21ms
memory: 4328kb

input:

249 184
............................................................................................................................................##.#.##......................................................................................................
.............................................

output:

..#..
..#..
#####
..#..
..#..

result:

ok 5 lines

Test #82:

score: 0
Accepted
time: 22ms
memory: 4468kb

input:

265 247
..............................................................................................................................................................###........................................................................................................
.............................

output:

..#..
..#..
#####
..#..
..#..

result:

ok 5 lines

Test #83:

score: 0
Accepted
time: 18ms
memory: 4320kb

input:

278 231
.......................................................................................................................................................................#.......#.......#..............................................................................................
................

output:

..#..
..#..
#####
..#..
..#..

result:

ok 5 lines

Test #84:

score: 0
Accepted
time: 18ms
memory: 4388kb

input:

244 240
...............................................#...#...#............................................................................................................................................................................................
..................................................

output:

..#..
..#..
#####
..#..
..#..

result:

ok 5 lines

Test #85:

score: 0
Accepted
time: 21ms
memory: 4452kb

input:

246 258
...............................................................................................................................................................................................................#...#.......#.......#...#..............
................................................

output:

..#..
..#..
#####
..#..
..#..

result:

ok 5 lines