QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#325632#4833. Tetra-puzzletuanlinh1230 1760ms104268kbC++205.5kb2024-02-11 18:14:112024-02-11 18:14:11

Judging History

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

  • [2024-02-11 18:14:11]
  • 评测
  • 测评结果:0
  • 用时:1760ms
  • 内存:104268kb
  • [2024-02-11 18:14:11]
  • 提交

answer

#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
inline ll IDX(ll i, ll j) {return i*5+j;}
inline bool BIT(ll mask, ll i, ll j) {return (mask&1<<IDX(i, j))!=0;}

struct piece
{
    ll val=0, h=0, w=0;
    piece(){}
    piece(char s)
    {
        vector <vector <bool>> a(5, vector <bool> (5, 0));
        if (s=='I') a[0][0]=a[1][0]=a[2][0]=a[3][0]=1, h=4, w=1;
        if (s=='L') a[0][0]=a[1][0]=a[2][0]=a[2][1]=1, h=3, w=2;
        if (s=='O') a[0][0]=a[0][1]=a[1][0]=a[1][1]=1, h=w=2;
        if (s=='T') a[0][0]=a[0][1]=a[0][2]=a[1][1]=1, h=2, w=3;
        if (s=='Z') a[0][0]=a[0][1]=a[1][1]=a[1][2]=1, h=2, w=3;
        for (ll i=0; i<5; i++)
            for (ll j=0; j<5; j++)
                if (a[i][j]) val|=1<<IDX(i, j);
    }

    inline void fdiag()
    {
        ll res=0;
        for (ll i=0; i<5; i++)
            for (ll j=0; j<5; j++)
                if (BIT(val, i, j))
                    res|=1<<IDX(j, i);
        val=res, swap(h, w);
    }
    inline void fhori()
    {
        ll res=0;
        for (ll i=0; i<5; i++)
            for (ll j=0; j<5; j++)
                if (BIT(val, i, j))
                    res|=1<<IDX(4-i, j);
        val=res;
    }
    inline void rotate()
    {
        fdiag();
        fhori();
    }
    inline void fix()
    {
        while (1)
        {
            bool ok=1;
            for (ll i=0; i<5; i++)
                if (BIT(val, 0, i))
                    {ok=0; break;}
            if (!ok) break;
            val>>=5;
        }
        while (1)
        {
            bool ok=1;
            for (ll i=0; i<5; i++)
                if (BIT(val, i, 0))
                    {ok=0; break;}
            if (!ok) break;
            val>>=1;
        }
    }

    void print()
    {
        cout << h << " " << w << "\n";
        for (ll i=0; i<5; i++)
            for (ll j=0; j<5; j++)
                cout << BIT(val, i, j) << " \n"[j==4];
    }
};

const ll all=(1<<25)-1, inf=1e9, cap=7500;
vector <pair<pll, pll>> best[1005];
vector <piece> I, L, O, T, Z;
ll hori[5], veri[5];
vector <ll> t[26];

struct state
{
    ll val=0;
    state(){}
    state(ll val): val(val){}
    ll evaluate(){return __builtin_popcount(val);}

    bool Move(ll move)
    {
        if ((val&move) || !move) return 0;
        ll ne=val|move, re=0;
        for (ll k=0; k<5; k++)
        {
            if ((ne|hori[k])==ne) 
                re|=hori[k];
            if ((ne|veri[k])==ne) 
                re|=veri[k];
        }
        val=ne^re;
        return 1;
    }

    ll findbest(ll c)
    {
        pll best={inf, 0};
        for (ll move:t[c]) 
        {
            state ne=*this;
            if (!ne.Move(move)) continue;
            best=min(best, mp(ne.evaluate(), move));
        }
        return best.se;
    }

    void act(ll move)
    {
        for (ll i=0; i<5; i++) for (ll j=0; j<5; j++)
        {
            if (BIT(val, i, j)) cout << '#';
            else if (BIT(move, i, j)) cout << '*';
            else cout << '.'; if (j==4) cout << "\n";
        }
        cout << endl, Move(move);
    }
};

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    for (ll i=0; i<5; i++)
        for (ll j=0; j<5; j++)
        {
            hori[i]|=1<<IDX(i, j);
            veri[j]|=1<<IDX(i, j);
        }
    auto init=[&](vector <piece> &a, char s)
    {
        a.resize(8), a[0]=piece(s);
        for (ll i=1; i<8; i++)
        {
            if (i<4) a[i]=a[i-1], a[i].rotate();
            else a[i]=a[i-4], a[i].fhori();
            a[i].fix();
        }
        map <ll, bool> Map;
        for (ll i=0; i<8; i++) for (ll j=0; j<=5-a[i].h; j++) for (ll k=0; k<=5-a[i].w; k++)
        {
            ll val=a[i].val<<IDX(j, k);
            if (!Map[val]) Map[val]=1, t[s-'A'].pb(val);
        }
    }; init(I, 'I'), init(L, 'L'), init(O, 'O'), init(T, 'T'), init(Z, 'Z');
    string type; cin >> type;
    if (type=="prepare")
    {
        ll n; cin >> n;
        best[0].pb({{0, 0}, {-1, -1}});
        for (ll i=1; i<=n; i++)
        {
            string c; cin >> c;
            vector <pair<ll, pll>> nbest[26];
            for (ll id=0; id<best[i-1].size(); id++)
            {
                pair<pll, pll> s=best[i-1][id];
                for (ll j=0; j<2; j++)
                {
                    state cr(s.fi.se);
                    if (!cr.Move(cr.findbest(c[j]-'A'))) continue;
                    nbest[cr.evaluate()].pb({cr.val, {id, c[j]-'A'}});
                }
            }
            for (ll j=0; j<=25; j++)
                for (pair<ll, pll> s:nbest[j])
                    if (best[i].size()<cap)
                        best[i].pb({{j, s.fi}, s.se});
        }
        string ans="";
        for (ll i=n, j=0; best[i][j].se.fi!=-1; j=best[i][j].se.fi, i--)
            ans=char(best[i][j].se.se+'A')+ans;
        cout << ans;
    }
    else
    {
        state cr; ll n; cin >> n;
        for (ll i=0; i<n; i++)
        {
            char c; cin >> c; c-='A';
            pll best={inf, 0};
            for (ll move:t[c]) 
            {
                state ne=cr;
                if (!ne.Move(move)) continue;
                best=min(best, mp(ne.evaluate(), move));
            }
            if (best.fi==inf) assert(0);
            cr.act(best.se);
        }
    }
}

詳細信息

Test #1:

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

First Run Input

prepare
6
TO LO ZI LI LT LT

First Run Output

OLZILL

Second Run Input

play
6
O
L
Z
I
L
L

Second Run Output

**...
**...
.....
.....
.....

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

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

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

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

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


result:

ok good job!

Test #2:

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

First Run Input

prepare
1
ZI

First Run Output

Z

Second Run Input

play
1
Z

Second Run Output

.**..
**...
.....
.....
.....


result:

ok good job!

Test #3:

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

First Run Input

prepare
10
LO TZ ZO OI OL ZL ZO TL OZ LO

First Run Output

OZZIOLOLOO

Second Run Input

play
10
O
Z
Z
I
O
L
O
L
O
O

Second Run Output

**...
**...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #4:

score: 100
Accepted
time: 45ms
memory: 5944kb

First Run Input

prepare
29
ZT OT ZL LT ZI LO IZ LT OI ZT ZT OL ZI LT LZ TZ IL ZI OT LZ LT LZ OT OI IO OZ IZ ZL ZL

First Run Output

ZTLLILZTITTLILLZLITLLLTIOOZLL

Second Run Input

play
29
Z
T
L
L
I
L
Z
T
I
T
T
L
I
L
L
Z
L
I
T
L
L
L
T
I
O
O
Z
L
L

Second Run Output

.**..
**...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #5:

score: 100
Accepted
time: 66ms
memory: 6888kb

First Run Input

prepare
36
TI ZT IT IT OT OZ IL TZ ZO LO LZ ZL OT ZI IL OT OT ZI ZT TZ TI LT LO OL IL OL IZ OZ OL ZL LT IO ZO ZL ZO LT

First Run Output

IZTTTOIZOLLLOIIOTZTTITLLLLIZLLLIOZZL

Second Run Input

play
36
I
Z
T
T
T
O
I
Z
O
L
L
L
O
I
I
O
T
Z
T
T
I
T
L
L
L
L
I
Z
L
L
L
I
O
Z
Z
L

Second Run Output

****.
.....
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #6:

score: 100
Accepted
time: 97ms
memory: 9416kb

First Run Input

prepare
57
LT OI TL IZ OT TL LT TI LO LT LO LO OL IO LI IT TZ TZ IO ZT TI OT OI TL TL ZT TZ OL OI LI OZ ZI TO LZ IO IO LT OZ TO OZ IZ TZ LT ZO TO TZ OT LT ZO OL IL LO ZT OZ OL IL ZI

First Run Output

TOLITTLTOTOLLIIITTOTITILLTZLIIOZTLIOTZTOITTZTTTTOLILTZLII

Second Run Input

play
57
T
O
L
I
T
T
L
T
O
T
O
L
L
I
I
I
T
T
O
T
I
T
I
L
L
T
Z
L
I
I
O
Z
T
L
I
O
T
Z
T
O
I
T
T
Z
T
T
T
T
O
L
I
L
T
Z
L
I
I

Second Run Output

***..
.*...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #7:

score: 100
Accepted
time: 162ms
memory: 13268kb

First Run Input

prepare
88
ZL OL OT IT LO ZL OI ZT TO OI OL OL LZ ZT TL TZ IO ZL TZ TO IL LO ZT OL LT ZI TZ IL LT ZL OT TI ZO ZO ZT OZ TL TL LO OI TO OZ LI ZO ZT ZT IO IZ OZ ZO ZI ZO IO IO TI OL IL IT IL TL TL ZL IT IT ZO IO OL IL ZI TO OL IL ZI LZ LT IL LI ZO IL TL IT LI ZI OL TO OZ IZ OZ

First Run Output

ZOOIOLIZOOLLLTTTILTOLOTLTIZITLTIOOZOTTLIOOLZTZIIOZIZIIILIIILLLITOILIZTLIIZLILZILTLILOZIO

Second Run Input

play
88
Z
O
O
I
O
L
I
Z
O
O
L
L
L
T
T
T
I
L
T
O
L
O
T
L
T
I
Z
I
T
L
T
I
O
O
Z
O
T
T
L
I
O
O
L
Z
T
Z
I
I
O
Z
I
Z
I
I
I
L
I
I
I
L
L
L
I
T
O
I
L
I
Z
T
L
I
I
Z
L
I
L
Z
I
L
T
L
I
L
O
Z
I
O

Second Run Output

.**..
**...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #8:

score: 100
Accepted
time: 224ms
memory: 15632kb

First Run Input

prepare
105
LI LI OI TL OZ LZ IL IZ IL TI IL IO OT LT LO ZO LI LZ OI IL ZT IT LZ IZ IZ LI IT LI IO TI ZL OI IT LO TZ OI IL OL IL OT IL OZ LT IO OL OL LO ZO TI LI LI LI ZO ZI LI OL TI TZ LO LT IL LZ IL OL ZT LT IZ IL TZ IT OZ TL ZI IZ IZ TO IT IO TO TI TO TZ ZT IZ LI IL ZI TI TL TZ TO LI LO OL IL IL ...

First Run Output

LLOTOZIILIIOOTLZIZIITILIIIIIITLIIOTILLLTIZLILOLZIILLOZILITOTILLOZLIITTOTIIZTIITTTTZILIIITTTIOLIITZLLOZITL

Second Run Input

play
105
L
L
O
T
O
Z
I
I
L
I
I
O
O
T
L
Z
I
Z
I
I
T
I
L
I
I
I
I
I
I
T
L
I
I
O
T
I
L
L
L
T
I
Z
L
I
L
O
L
Z
I
I
L
L
O
Z
I
L
I
T
O
T
I
L
L
O
Z
L
I
I
T
T
O
T
I
I
Z
T
I
I
T
T
T
T
Z
I
L
I
I
I
T
T
T
I
O
L
I
I
T
Z
L
L
O
Z
I
T
L

Second Run Output

***..
*....
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #9:

score: 100
Accepted
time: 455ms
memory: 28580kb

First Run Input

prepare
204
TZ TL OL TL ZO OT ZO LI TZ IO TI OL LZ TI TO ZT IL OI LT IT OZ TI OT TI ZL ZI ZO TI OI ZI TL LI ZI IO TI ZL LZ OL ZI TZ OI OI IZ LO IL LO IZ ZT ZT OL ZI OZ TL OI TI IT IZ ZL TI OI LZ OI TZ IZ IO OZ ZI TO OT TI TO IO IZ OI TZ LT TZ ZI OL LO LO OZ LO ZL LZ TZ LT TO OL LO LT TZ TL OZ ZO LO ...

First Run Output

TTLLOTOLZIILLITTLILIOITILIOTIZTIIIILZLZTOIILILITZLIOLITIILIOLOTIOOITTITIIITLTZLLOOOLZTLTOLTTLOOLOLIITIOLLOZIZTILZIOILITIILZIITITIZLLTLILILZLTLTZLIZLOILZZTLIILIOOLLIZILOZIZTLLOTLTIILTIIILLZITIIOZLLITTLOTTL

Second Run Input

play
204
T
T
L
L
O
T
O
L
Z
I
I
L
L
I
T
T
L
I
L
I
O
I
T
I
L
I
O
T
I
Z
T
I
I
I
I
L
Z
L
Z
T
O
I
I
L
I
L
I
T
Z
L
I
O
L
I
T
I
I
L
I
O
L
O
T
I
O
O
I
T
T
I
T
I
I
I
T
L
T
Z
L
L
O
O
O
L
Z
T
L
T
O
L
T
T
L
O
O
L
O
L
I
I
T
I
O
L
L
O
Z
I
Z
T
I
L
Z
I
O
I
L
I
T
I
I
L
Z
I
I
T
I
T
I
Z
L
L
T
L
I
L
I
L
Z
L
T
L
T
Z
L
I...

Second Run Output

***..
.*...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #10:

score: 100
Accepted
time: 666ms
memory: 40760kb

First Run Input

prepare
303
ZT ZT IO ZL LT TI LO LZ TI ZT TI ZT LO OZ ZT TL IT TZ ZI IL TL OZ IO OT ZT TI LT ZT ZL ZL IO LZ IZ IZ ZT TZ OT OI LZ IL IZ TL IT ZO TL ZL IZ IZ LO LO ZI TI OT ZT OI IT ZI IL OI TO ZL LI TL LT OI LZ TI TZ OL ZO OZ IL LO ZT ZL IT TO ZI TZ IL IO LO LT IT OL LO ZT OZ OI TI OL OZ ZI IT IO IT ...

First Run Output

TTOLLTOLTZTZLOTTITIITOITTILZZLOLZITTTOLLILIOLZIIOLZIOTIIIIITLILLOZIZLOZLLTZITITIILLIOLZZITLOZIIIILIZOLITTTTILIOLZZTTLZZLTILOZLZOTTIOOIIIIIOLOIIITLZZLOLILOTOLILIITTTTIZLLITIILOOTTILOILTIZIIITOLOLOOLITITIZLTITOTTTLLIOTIOIIOLTOTOZILTOIOZOLLILIOOLIZLIITLLLOZLOLZOIIIIILOTLLIOLOITLIIZILOLLOZOIIITIIZTIILLTOLO

Second Run Input

play
303
T
T
O
L
L
T
O
L
T
Z
T
Z
L
O
T
T
I
T
I
I
T
O
I
T
T
I
L
Z
Z
L
O
L
Z
I
T
T
T
O
L
L
I
L
I
O
L
Z
I
I
O
L
Z
I
O
T
I
I
I
I
I
T
L
I
L
L
O
Z
I
Z
L
O
Z
L
L
T
Z
I
T
I
T
I
I
L
L
I
O
L
Z
Z
I
T
L
O
Z
I
I
I
I
L
I
Z
O
L
I
T
T
T
T
I
L
I
O
L
Z
Z
T
T
L
Z
Z
L
T
I
L
O
Z
L
Z
O
T
T
I
O
O
I
I
I
I
I
O
L
O
I
I
I
T
L...

Second Run Output

***..
.*...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #11:

score: 100
Accepted
time: 1104ms
memory: 66020kb

First Run Input

prepare
502
LO LI OZ LO IO ZT LO OZ OZ ZI IO OT ZO LZ IZ ZT TL TL LI IL IZ TO IO IL OL OL OL LO ZI OZ OZ ZO OZ IT OZ LZ TZ TO LZ TL ZL IZ LZ ZO ZL IO IL LI LT ZI OZ IZ OI TZ LI ZT IT LO TO ZI LT OT LZ OI LZ OZ LZ IT TO TI OI TO TO OI TZ ZL IO OZ ZO ZL LZ IZ OI TL TO TI LZ ZL ZL OZ TI ZI TL LO ZT LI ...

First Run Output

OIOLOZLOOZITOLITLLLLIOIILLOLIZOOOTOZTOZTLILOLOIITIOIIZITIOOZTTLILOZIOIIOOOZLIZZLZIOTTILZLOTILLZLIIOZTTILOLOOLZTLZILOLZTTLOZZZLOTIIIILIILLILOOOITIZOLLOOLZZTLTZLILTIIILOLTTTTTTOLTTLTZLIOOTIITLTIOOTILOTTZTIZTILIZIZIIOIOLTLZLOZTTIILIOLOILLLLZZTLTIZOIIIIZTZLOZLOOOZILOLZTIIILOLTILIIIIITIOLIIZOZOILTIIILIOL...

Second Run Input

play
502
O
I
O
L
O
Z
L
O
O
Z
I
T
O
L
I
T
L
L
L
L
I
O
I
I
L
L
O
L
I
Z
O
O
O
T
O
Z
T
O
Z
T
L
I
L
O
L
O
I
I
T
I
O
I
I
Z
I
T
I
O
O
Z
T
T
L
I
L
O
Z
I
O
I
I
O
O
O
Z
L
I
Z
Z
L
Z
I
O
T
T
I
L
Z
L
O
T
I
L
L
Z
L
I
I
O
Z
T
T
I
L
O
L
O
O
L
Z
T
L
Z
I
L
O
L
Z
T
T
L
O
Z
Z
Z
L
O
T
I
I
I
I
L
I
I
L
L
I
L
O
O
O
I
T
I
Z...

Second Run Output

**...
**...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #12:

score: 100
Accepted
time: 1760ms
memory: 104268kb

First Run Input

prepare
801
TL TL TZ LO LO TI ZI LI LZ OT OZ LT OL IL OZ OT OT IO ZL OZ OT ZL LO TO TZ TL OI ZO TI ZI TO IT ZL TZ IZ IT IL ZO IO LT ZI OZ LO TI OI TO LI IL LT LZ LT OZ IL LZ ZO ZT IL ZL TZ OI IZ TL ZI OT TO IL IO OZ IO ZL OT IZ IZ IT IT OI OZ ZL ZT ZT OI IT IZ IL ZL LZ TI IZ IZ IZ ZI LT ZT LZ IO LZ ...

First Run Output

TTZLLTIIZOZLLIZTOILOTLLTTLOZTITILZIIIZITIOLIITILTLLOLLOZILZOILITTIOOILOIIITIOLZTIIIILLIIZIILTLOLTOTLLTLOLOTILOOOLITILIILZOLOLOTLZZLOLIITOIOIZLTTTTZTIIITTTIIIZOTLILIOLIIOLOLIIZTIITLITOLLTOLTIOILOTOIIITIOLZLLZLIOILIITILIOLTLLTLLLIILTIITIITOILZILTOIOLZLILIOZTOOLOLZLLIIILOZTIZLTITZIILOLITILIIZTOZZOTLTOT...

Second Run Input

play
801
T
T
Z
L
L
T
I
I
Z
O
Z
L
L
I
Z
T
O
I
L
O
T
L
L
T
T
L
O
Z
T
I
T
I
L
Z
I
I
I
Z
I
T
I
O
L
I
I
T
I
L
T
L
L
O
L
L
O
Z
I
L
Z
O
I
L
I
T
T
I
O
O
I
L
O
I
I
I
T
I
O
L
Z
T
I
I
I
I
L
L
I
I
Z
I
I
L
T
L
O
L
T
O
T
L
L
T
L
O
L
O
T
I
L
O
O
O
L
I
T
I
L
I
I
L
Z
O
L
O
L
O
T
L
Z
Z
L
O
L
I
I
T
O
I
O
I
Z
L
T
T
T
T...

Second Run Output

***..
.*...
.....
.....
.....

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #13:

score: 0
Stage 1: Program answer Time Limit Exceeded

First Run Input

prepare
1000
LT LT TO OL ZI OI IO IL TO IO IT LZ ZL ZL OL OI OL TO IO OL IZ ZO TZ OZ TL LT IZ LO IZ IO IO ZT IO TZ LI ZL ZT LT TL TL IL TI OZ LO TO OI LI LI OL ZI ZI TI IO OL ZT LT ZL ZI TZ TL OT ZL OT TI OL IT ZL IT OT LZ LZ LZ IL OZ LO ZI TZ IT TO TZ OZ ZI IT TZ LZ ZT ZO LT OT TI OZ LI OZ TL LO OT...

First Run Output


Second Run Input


Second Run Output


result: