QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#323481#4833. Tetra-puzzleduongnc0000 558ms24392kbC++207.0kb2024-02-09 22:04:082024-02-09 22:04:08

Judging History

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

  • [2024-02-09 22:04:08]
  • 评测
  • 测评结果:0
  • 用时:558ms
  • 内存:24392kb
  • [2024-02-09 22:04:08]
  • 提交

answer


#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt")


#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define pb push_back
#define ff first
#define ss second
#define isz(x) (int)x.size()
using namespace std;

const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
const i64 oo = 1e18;

namespace Piece {
    vector<vector<pair<int, int>>> L = {{{0, 0}, {0, 1}, {1, 0}, {2, 0}},
                                        {{0, 0}, {0, 1}, {0, 2}, {1, 0}},
                                        {{0, 0}, {0, 1}, {1, 1}, {2, 1}},
                                        {{0, 0}, {0, 1}, {0, 2}, {1, 2}},
                                        {{0, 0}, {1, 0}, {2, 0}, {2, 1}},
                                        {{0, 0}, {1, 0}, {1, 1}, {1, 2}},
                                        {{2, 0}, {2, 1}, {1, 1}, {0, 1}},
                                        {{1, 0}, {1, 1}, {1, 2}, {0, 2}}};

    vector<vector<pair<int, int>>> I = {{{0, 0}, {0, 1}, {0, 2}, {0, 3}},
                                        {{0, 0}, {1, 0}, {2, 0}, {3, 0}}};

    vector<vector<pair<int, int>>> O = {{{0, 0}, {0, 1}, {1, 0}, {1, 1}}};

    vector<vector<pair<int, int>>> T = {{{0, 0}, {1, 0}, {1, 1}, {2, 0}},
                                        {{0, 0}, {0, 1}, {0, 2}, {1, 1}},
                                        {{0, 1}, {1, 0}, {1, 1}, {1, 2}},
                                        {{0, 1}, {1, 0}, {1, 1}, {2, 1}}};

    vector<vector<pair<int, int>>> Z = {{{0, 0}, {0, 1}, {1, 1}, {1, 2}},
                                        {{0, 1}, {1, 0}, {1, 1}, {2, 0}},
                                        {{0, 1}, {0, 2}, {1, 0}, {1, 1}},
                                        {{0, 0}, {1, 0}, {1, 1}, {2, 1}}};
    vector<vector<pair<int, int>>> get_vector(char shape) {
        if (shape == 'L') return L;
        if (shape == 'I') return I;
        if (shape == 'O') return O;
        if (shape == 'T') return T;
        if (shape == 'Z') return Z;
        return {};
    }
};

bool check(int x, int y) {
    return 0 <= x and x < 5 and 0 <= y and y < 5;
}

int conv[5][5] = {{0, 1, 2, 3, 4},
                  {5, 6, 7, 8, 9},
                  {10, 11, 12, 13, 14},
                  {15, 16, 17, 18, 19},
                  {20, 21, 22, 23, 24}};

struct State {
    int a[5][5], msk, score;
    pair<int, char> prv;

    State() {
        memset(a, 0, sizeof a);
        score = 25, msk = 0, prv = {-1, 0};
    }

    bool operator < (const State &rhs) const {
        if (score == rhs.score) return msk > rhs.msk;
        return score > rhs.score;
    }

    void clear() {
        int row[5]{}, col[5]{};
        for (int i = 0; i < 5; ++i) for (int j = 0; j < 5; ++j) a[i][j] = !!a[i][j], row[i] += a[i][j], col[j] += a[i][j];
        for (int i = 0; i < 5; ++i) for (int j = 0; j < 5; ++j) if (row[i] == 5 or col[j] == 5) a[i][j] = 0, ++score, msk ^= 1 << conv[i][j];
    }

    pair<bool, pair<State, State>> test(int x, int y, vector<pair<int, int>> way, pair<int, char> cook) {
        State res = *this;
        for (auto [dx, dy] : way) {
            if (!check(x + dx, y + dy) or res.a[x + dx][y + dy]) return {false, {res, res}};
            res.a[x + dx][y + dy] = 2, --res.score, res.msk ^= 1 << conv[x + dx][y + dy];
        }
        pair<bool, pair<State, State>> rres = {true, {res, res}};
        res.clear(); res.prv = cook; rres.ss.ss = res;
        return rres;
    }
};

void try_piece(State cur, char shape, vector<State> &res, int idx) {
    auto ways = Piece::get_vector(shape);
    bool bestge = false; State rres;
    for (int i = 0; i < 4; ++i) for (int j = 0; j < 4; ++j) {
        for (int k = 0; k < isz(ways); ++k) {
            auto ncur = cur.test(i, j, ways[k], {idx, shape});
            if (ncur.ff) {
                if (bestge) rres = min(rres, ncur.ss.ss);
                else rres = ncur.ss.ss, bestge = true;
            }
        }
    }
    if (bestge) res.emplace_back(rres);
}

void try_piece2(State cur, char shape, vector<pair<State, State>> &res, int idx) {
    auto ways = Piece::get_vector(shape);
    for (int i = 0; i < 4; ++i) for (int j = 0; j < 4; ++j) for (int k = 0; k < isz(ways); ++k) {
        auto ncur = cur.test(i, j, ways[k], {idx, shape});
        if (ncur.ff) res.emplace_back(ncur.ss.ss, ncur.ss.ff);
    }
}

void prepare() {
    int n; cin >> n;
    string res = "";
    vector<vector<State>> best(n + 1);
    best[0].resize(1);
    for (int i = 1; i <= n; ++i) {
        string s; cin >> s;
        for (int j = 0; j < isz(best[i - 1]); ++j) {
            try_piece(best[i - 1][j], s[0], best[i], j);
            try_piece(best[i - 1][j], s[1], best[i], j);
        }
        assert(!best[i].empty());
        // if (best[i].empty()) {
        //     cout << i << " " << 
        //     "\n";
        //     for (auto state : best[i - 1]) {
        //         for (int j = 0; j < 5; ++j) for (int k = 0; k < 5; ++k) cout << state.a[j][k] << (k == 4 ? "\n" : "");
        //         cout << "\n";
        //     }
        // }
        sort(all(best[i]));
        if (isz(best[i]) > 100) best[i].resize(100);
    }
    int cidx = 0;
    for (int i = n; i >= 1; --i) {
        // cout << i << " " << isz(best[i]) << endl;
        res.push_back(best[i][cidx].prv.ss);
        cidx = best[i][cidx].prv.ff;
        // cout << cidx << endl;
    }
    reverse(all(res)); cout << res << endl;
}

void play() {
    int n; cin >> n;
    State cur;
    for (int i = 1; i <= n; ++i) {
        char ch; cin >> ch;
        vector<pair<State, State>> res;
        try_piece2(cur, ch, res, -1);

        assert(!res.empty());
        
        sort(all(res)); cur = res[0].ss;
        for (int j = 0; j < 5; ++j) {
            for (int k = 0; k < 5; ++k) {
                if (cur.a[j][k] == 0) cout << '.';
                if (cur.a[j][k] == 1) cout << '#';
                if (cur.a[j][k] == 2) cout << '*';
            }
            cout << endl;
        }
        cur = res[0].ff;
        cout << endl;
    }
}

string name;

void solve() {
    cin >> name;
    if (name == "prepare") prepare();
    else play();
}

signed main() {

#ifndef CDuongg
    if(fopen(taskname".inp", "r"))
        assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout));
#else
    freopen("bai3.inp", "r", stdin);
    freopen("bai3.out", "w", stdout);
    auto start = chrono::high_resolution_clock::now();
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1; //cin >> t;
    while(t--) solve();

#ifdef CDuongg
   auto end = chrono::high_resolution_clock::now();
   cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '=';
   cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
   cout << "Check array size pls sir" << endl;
#endif

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

First Run Input

prepare
6
TO LO ZI LI LT LT

First Run Output

OLIITL

Second Run Input

play
6
O
L
I
I
T
L

Second Run Output

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

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

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

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

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

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


result:

ok good job!

Test #2:

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

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: 4ms
memory: 3820kb

First Run Input

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

First Run Output

OTOOOLOLOO

Second Run Input

play
10
O
T
O
O
O
L
O
L
O
O

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #4:

score: 100
Accepted
time: 19ms
memory: 4000kb

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

ZTLTZLILIZZLILZTLIOLLLTIOOILZ

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

.....
.....
.....
......

result:

ok good job!

Test #5:

score: 100
Accepted
time: 24ms
memory: 3908kb

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

TTIIOZLZZLZLTZITOITTILLLLLIOLLTIOLOL

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #6:

score: 100
Accepted
time: 38ms
memory: 4900kb

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

TOTIOTLIOLOOLOLTTTIZITILLTZLIIZZTLIITZTZITTZOZTTOLILTZLLI

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #7:

score: 100
Accepted
time: 56ms
memory: 5672kb

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

LOTTLLIZOOLOLTLTILTOIOZOLZTLTLTIOOTOTTOIOZLOZZIIZZIOIOIOLIITTLTIOOLLIOLIZLTLIZLLIIILOZIZ

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #8:

score: 100
Accepted
time: 64ms
memory: 5784kb

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

LIITZLIZLILIOLOOLZOLTILIZLIIITLITLTILLLTLZLOLLOOTILLZILLIZLTIZILZLILTIOLZZZTIITIOTTZLIITLTTLLOILTZLLZITTO

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #9:

score: 100
Accepted
time: 141ms
memory: 8392kb

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

TLOLOTZITIILLITTIILTOTTILIZTIITLZIIZLLITOIZLLLITTOIOTITIILTILIZIOZITTTTIIIZTTILOLOOLLTTTOLTTLZZLZLTITLOLLOZILTOTOIIILOTITLTIZIIIIZLTTLIIILTLTLLTLTLLZOLZTTLIIZOZILLTLOLZZIOTLZIOLTIOLLOIZLIZILIIZILLLTLTOLZO

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #10:

score: 100
Accepted
time: 216ms
memory: 11044kb

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

ZTIZLIOLIZITLOTTIZILLOOTTILZZLIZZITTOOLLITIZLLIILOZIOTITILITLILLOLITOOZLOTZITZZIILTIOLZOIILOZTITITZLTTIZLTTLIOOLOTTLZOILIIZOZLZTOTIZOIZLOLLTOIZIZLZZLILITOTILLLILTOTTITZLILIILLLTLZLOZLIZIOIITZLOLZLLILLTTTLLTTTTTLOLITTIOIOZLTZTTZILTZITZLLZILIOOLZZLIZTLLLTZLLLLTITOTLLTOLLIILLILLILZILTILOLZITITIILTIILLT...

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

.....
.....
.....
......

result:

ok good job!

Test #11:

score: 100
Accepted
time: 334ms
memory: 16400kb

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

LLOLITLOZZOTZLIZLLILIOOLOLOOIZZOOIOZTTLTLILOZIILLIOIIZITIOTILOZIZZLIOIOTTOTZIOZLLIOLTILLLOTILOZIOTTOOTILLILOOOOLOTLZLZLOTLOTOLOTIIOZLLOOIILOZZZTIOOLTLTTZLITTZLILTZLILOTTTLTTIOLTTLZLLTTOTLOTLTILOTILOTTOTTTZILIOIZTITITLTLLLOZTZIILZOLOIZLTOZITILIOOIIIITLLLOTLOILIILOOZZIIITOTTIZITIIITIILTIOOTOOLTLIILIZL...

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #12:

score: 100
Accepted
time: 558ms
memory: 24392kb

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

LLTOLIIILOZLOIZTTILZTLOTTLIZIITILTITLZILZOOTITLLTLTZLZOTILZOILIOOLOOILOIIITIOZZZIIIILLIIZIITTLOLZOLZLTZLLZTITIOLZZLILIILOOLOLOZOLIZZLIITLIZIZLLTLTITZLITTTIIIZOOZZLIOLIIOLOLLOOTOOTLITOTLIZOLITILILOIILOIOOTIOOLILILIOTZLILLIOZTILOOLZIIOTITTOILTITTLIOLOZILLITTOTLTTZTLITILIZITLOTITTOIOTIIZILIILILITOTLTOI...

Second Run Input

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

Second Run Output

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

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

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

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

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

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

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

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

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

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

result:

ok good job!

Test #13:

score: 0
Stage 1: Program answer Runtime Error

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: