QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#206746#5161. Last GuessMinhhoRE 3ms6488kbC++206.8kb2023-10-07 22:33:282023-10-07 22:33:28

Judging History

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

  • [2023-10-07 22:33:28]
  • 评测
  • 测评结果:RE
  • 用时:3ms
  • 内存:6488kb
  • [2023-10-07 22:33:28]
  • 提交

answer

#define taskname "L"
#include <bits/stdc++.h>

using namespace std;

const int maxn = 2005, oo = 1e9;
vector<int> adj[maxn];
int cap[30], mn[30], fx[maxn], ban[maxn][30], cur[maxn], d[maxn], ans[maxn], fxl[30];
int tin[maxn], tout[maxn], cnt, n, m, s, t, _s, _t, cell, l;
string ds[maxn], dt[maxn];

struct edge {
    int u, v, de, f, c;
} e[maxn*maxn];

inline void add(int u, int v, int c, int de = 0)
{
    if (c == 0) return;
    if (v == t) assert(u >= cell+1 && u <= cell+l);
    if (u == s) assert(v == _t);
//    if ((u == s || v == t || true) && (c > 0))
//    cerr<<"ADD: "<<u<<" "<<v<<" "<<c<<" "<<de<<"\n";
    adj[u].emplace_back(cnt);
    e[cnt++] = {u, v, de, 0, c};
    tin[v] += de;
    tout[u] += de;
    adj[v].emplace_back(cnt);
    e[cnt++] = {v, u, 0, 0, 0};
}

inline bool BFS(int st = s, int ed = t)
{
    fill(d, d+ed+1, -1);
    d[st] = 0;
    queue<int> q;
    q.emplace(st);
    while (q.size())
    {
        int u = q.front(); q.pop();
        for (int id: adj[u])
        {
            auto [_, v, de, f, c] = e[id];
            if (d[v] == -1 && f < c) d[v] = d[u] + 1, q.emplace(v);
        }
    }
    return d[ed] != -1;
}

int DFS(int u = s, int flow = 1e9)
{
//    cerr<<"CUR: "<<u<<" "<<flow<<"\n";
    if (u == t) return flow;
    for (int &i=cur[u]; i<adj[u].size(); i++)
    {
        int id = adj[u][i];
        auto [_, v, de, f, c] = e[id];
        if (d[v] == d[u] + 1 && f < c)
        {
            int tmp = DFS(v, min(flow, c - f));
            if (tmp)
            {
                e[id].f += tmp;
                e[id^1].f -= tmp;
                return tmp;
            }
        }
    }
    return 0;
}

/**
s = 0
cells: 1 -> cell
letters: cell+1 -> cell+l
_s = cell+l+1;
_t = cell+l+2;
t = cell+l+3
**/
/**
string aa = "lufzobcdioevnkuwizhx", bb = "YYBBBGBBBBBGBBBBBBBB", cc = "vavlabmpqravasaauavj";
**/
inline void comp(string a, string b, string c, int id)
{

//    int tp[30], bn[30], dm[30];
//    memset(tp, 0, sizeof tp);
//    memset(bn, 0x3f3f3f, sizeof bn);
//    memset(dm, 0, sizeof dm);
//    for (int i=0; i<a.size(); i++)
//    {
//        if (b[i] != 'B') tp[a[i]-'a']++;
//        else bn[a[i]-'a'] = 1;
//    }
//    for (int i=0; i<26; i++) if (bn[i] == 1) bn[i] = tp[i];
//    bool f = 0;
//    for (int i=0; i<a.size(); i++)
//    {
//        dm[c[i]-'a']++;
//        if (b[i] == 'G' && a[i] != c[i]) f = 1, cout<<"WA: "<<i<<" NOT MATCH\n";
//    }
//    for (int i=0; i<26; i++)
//    {
//        if (dm[i] < tp[i]) f = 1, cout<<"WA: "<<(char)(i+'a')<<" NOT ENOUGH "<<"SHOULD HAVE: "<<tp[i]<<" FOUND: "<<dm[i]<<"\n";
//        if (dm[i] > bn[i]) f = 1, cout<<"WA: "<<(char)(i+'a')<<" TOO MANY\n";
//    }
//    if (f) cout<<"WORD: "<<id<<" "<<dt[id]<<" "<<ds[id]<<"\n";
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cin>>m>>n;
    memset(fx, -1, sizeof fx);
    memset(ans, -1, sizeof ans);
    for (int i=0; i<26; i++) cap[i] = 1e9;
    int mdem[30], mg[30];
    memset(mdem, 0, sizeof mdem);
    memset(mg, 0, sizeof mg);
    for (int i=1; i<m; i++)
    {
        string s, t;
        cin>>t>>s;
        dt[i] = t;
        ds[i] = s;
        int tmp[30], dem[30], tg[30];
        memset(dem, 0, sizeof dem);
        memset(tmp, 0, sizeof tmp);
        memset(tg, 0, sizeof tg);
        vector<int> bn;
        for (int j=0; j<n; j++)
            if (s[j] == 'G') fx[j] = t[j] - 'a', ans[j] = t[j] - 'a', dem[t[j]-'a']++, tg[t[j]-'a']++;
            else if (s[j] == 'Y') ban[j][t[j]-'a'] = 1, dem[t[j]-'a']++, tmp[t[j]-'a']++;
            else bn.emplace_back(t[j]-'a'), ban[j][t[j]-'a'] = 1;
        for (int j: bn) if (cap[j] == 1e9) cap[j] = dem[j]; else assert(cap[j] == dem[j]);
        for (int j=0; j<26; j++) mn[j] = max(mn[j], tmp[j]), mdem[j] = max(mdem[j], dem[j]), mg[j] = max(mg[j], tg[j]);
    }
    for (int i=0; i<n; i++) if (fx[i] != -1) fxl[fx[i]]++;
    for (int i=0; i<26; i++) cap[i] -= fxl[i], mn[i] = mdem[i] - mg[i];
    for (int i=0; i<26; i++) assert(mn[i] <= cap[i]);

    cell = 0;
    vector<int> ve;
    for (int i=0; i<n; i++) if (fx[i] == -1) ve.emplace_back(i);
    cell = ve.size();
    l = 26;
    s = 0;
    _s = cell+l+1;
    _t = _s+1;
    t = _t+1;
//    cerr<<"SS: "<<s<<" "<<t<<"\n";
    int din = 0;
    for (int i=1; i<=cell; i++)
    {
        add(_s, i, 1);
        for (int j=1; j<=26; j++) if (!ban[ve[i-1]][j-1]) add(i, cell+j, 1), din += (j == 25);
    }
    for (int i=1; i<=26; i++) add(cell+i, _t, cap[i-1], mn[i-1]);
    add(_t, _s, oo);
    for (int i=0; i<cnt; i++) e[i].c -= e[i].de;
    for (int i=1; i<t; i++) add(s, i, tin[i]), add(i, t, tout[i]);
//    if (m == 30 && n == 20) cout<<"Y: "<<mn[24]<<" "<<tout[cell+25]<<" "<<din<<"\n";
    int anss = 0;
    while (BFS())
    {
        fill(cur, cur+t+1, 0);
        int x;
        while (x = DFS(s, cell)) anss += x;
    }
    int smn = accumulate(mn, mn+26, 0);
    assert(anss == smn);
//    cerr<<"LUONG: "<<anss<<"\n";
    for (int i=0; i<cnt; i++)
    {
        auto [u, v, de, f, c] = e[i];
        if (u >= 1 && u <= cell && v >= cell+1 && v <= cell+l)
        {
//            cerr<<"F & C: "<<f<<" "<<c<<"\n";
//            cerr<<"WUT: "<<u<<" "<<v<<" "<<d[u]<<" "<<d[v]<<"\n";
            if (f == c)
                ans[ve[u-1]] = v - (cell+1);//, cerr<<"ANS: "<<ve[u-1]<<" "<<(v-cell-1)<<"\n";
        }
    }
    string res="";
    for (int i=0; i<n; i++) res += (char)(ans[i]+'a');
    string a = "oweejfrjrgbeefeghhhzkjiiliihtjzoullzpmxzkmpzoymetieqpcsdqseqqtzjtrrvxrtttcwcwy",
    b = "imwrldcrlcooqlzmcczciijjughombdengtcurojkwqyuoqltmduvwebvyysshwjythllxhrwmcepz",
    c = "YYYYYYYYYYYYYYYYYBYBYYYYYYYYYYBYBYYBBYBYGYYYBBYBGBBBYYYBBYYYYYBGBYYBBYYYBBBYYY";
    comp(b, c, a, 1);
//    if (res[0] == 'v')
//        for (int i=1; i<m; i++)
//        {
//            string aa = dt[i], bb = ds[i], cc = res;
//            comp(aa, bb, cc, i);
//        }
//    for (int i=1; i<m; i++)
//    {
//        for (int j=0; j<n; j++)
//        {
//            if (ds[i][j] == 'G')
//            {
//                if (res[j] != dt[i][j]) cout<<"WA ON TEST: "<<i<<" MUST BE: "<<dt[i][j]<<" AT: "<<j<<" FOUND: "<<res[j]<<"\n";
//            }
//            else
//            {
//                if (res[j] == dt[i][j]) cout<<"WA ON TEST: "<<i<<" MUST NOT BE: "<<dt[i][j]<<" AT: "<<j<<" FOUND: "<<res[j]<<"\n";
//            }
//        }
//    }
    cout<<res;
//    if (res[0] == 'v') for (int i=21; i<m; i++) cout<<"\n"<<ds[i]<<" "<<dt[i];
}
/**
oweejfrjrgbeefeghhhzkjiiliihtjzoullzpmxzkmpzoymetieqpcsdqseqqtzjtrrvxrtttcwcwy
imwrldcrlcooqlzmcczciijjughombdengtcurojkwqyuoqltmduvwebvyysshwjythllxhrwmcepz
YYYYYYYYYYYYYYYYYBYBYYYYYYYYYYBYBYYBBYBYGYYYBBYBGBBBYYYBBYYYYYBGBYYBBYYYBBBYYY
**/

詳細信息

Test #1:

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

input:

4 5
reply YYGBB
refer BBBGG
puppy YYGBB

output:

upper

result:

ok 

Test #2:

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

input:

2 12
aabbccddeeff GGGYGBYYYBBB

output:

aabdcbe`d```

result:

ok 

Test #3:

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

input:

25 500
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqoqqqqqqqqqqqqqqqqqqqqqqoqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjq...

output:

abcdefghijklmnoooprstuvwxyz`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````...

result:

ok 

Test #4:

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

input:

24 500
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvuvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

abcdefghijklmnoppqrstuwxyz``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````...

result:

ok 

Test #5:

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

input:

23 500
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqgqqqqq...

output:

abcdefggghijklmnoprstuuuvwxyz```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````...

result:

ok 

Test #6:

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

input:

22 500
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccoccccccccccccccccccccccccccccccccccccccccccccccccfccccccccccccccccccccccccccccccccc...

output:

abbbdefffghijklmnopqrstuvwxyz```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````...

result:

ok 

Test #7:

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

input:

30 20
azzzzzzzzzzzzzzzzzzz YBBBBBBBBBBBBBBBBBBB
zazzzzzzzzzzzzzzzzzz BGBBBBBBBBBBBBBBBBBB
zzazzzzzzzzzzzzzzzzz BBYBBBBBBBBBBBBBBBBB
zzzazzzzzzzzzzzzzzzz BBBYBBBBBBBBBBBBBBBB
zzzzazzzzzzzzzzzzzzz BBBBGBBBBBBBBBBBBBBB
zzzzzazzzzzzzzzzzzzz BBBBBYBBBBBBBBBBBBBB
zzzzzzazzzzzzzzzzzzz BBBBBBYBBBBBBBBBBBBB
...

output:

vaylabmpqravasaauavj

result:

ok 

Test #8:

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

input:

31 20
azzzzzzzzzzzzzzzzzzz GBBBBBBBBBBBBBBBBBBB
zazzzzzzzzzzzzzzzzzz BYBBBBBBBBBBBBBBBBBB
zzazzzzzzzzzzzzzzzzz BBYBBBBBBBBBBBBBBBBB
zzzazzzzzzzzzzzzzzzz BBBYBBBBBBBBBBBBBBBB
zzzzazzzzzzzzzzzzzzz BBBBYBBBBBBBBBBBBBBB
zzzzzazzzzzzzzzzzzzz BBBBBYBBBBBBBBBBBBBB
zzzzzzazzzzzzzzzzzzz BBBBBBGBBBBBBBBBBBBB
...

output:

avqduiasiaafbu``ayya

result:

ok 

Test #9:

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

input:

38 20
azzzzzzzzzzzzzzzzzzz YBBBBBBBBBBBBBBBBBBB
zazzzzzzzzzzzzzzzzzz BGBBBBBBBBBBBBBBBBBB
zzazzzzzzzzzzzzzzzzz BBYBBBBBBBBBBBBBBBBB
zzzazzzzzzzzzzzzzzzz BBBGBBBBBBBBBBBBBBBB
zzzzazzzzzzzzzzzzzzz BBBBGBBBBBBBBBBBBBBB
zzzzzazzzzzzzzzzzzzz BBBBBYBBBBBBBBBBBBBB
zzzzzzazzzzzzzzzzzzz BBBBBBYBBBBBBBBBBBBB
...

output:

sawaaooaaaeakaahaaal

result:

ok 

Test #10:

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

input:

25 500
eppppsppppppappppapppaswppspwppeupppwpwppppwppspppppppapppppspppappwpppppspspuppppppppppupwppeppppppppuppppusppspppppppwppppppppspeppppppppppepspppeppuppppwpppppppppppppwpppppppwppupppppspppppppppppppupeppppppppsppppeppaeppppppppppppppppppappppppppppppppppsppwppuappppepupuapppeppppppapppppppp...

output:

vayjogcjsnarhzfrshqbxhg`rsgm`tjvlabd`k`nenu`zmgwwuqtzohxzeudgtmnhsa`acratgwgjljtkyetowdwla`bdvksccbsonlmrdjlgbngconrstm`dytrdknwgjvyxzueqskrnvqgzmtvaelfxub`aqctbexjeftot`nkqfsus`nolqbsxjgcrqwkerywwmyylevubemsnzagqjtuvcuhvrbcnfcxznfymkquskbhffkcxrezezkemfyfgfz`rxlhanfbvrldlhfcavqzzcbyhycwtknftnxhomqg...

result:

ok 

Test #11:

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

input:

25 500
smxeetdiacxotgkpibsieraggqfjdbjxykzpiinrjxkmcczngkgpidtnacrzonzmrjsyfaiptigawddifgqxiiqibyymxvzncvifqsyfxmeodqwvwgqegpizkzfvsyywomkaviwjcasacijfbpjibvsroitinpfddjzcdkmxeisynrzipizmoyveveqwsfaqixobgrkstwtdtcfbwrvyvrgwdcmjozmitwcfitpzqdnikqbcpzyerwwigzdiczfmagmvacqxwbbiiiqrgxwvprvicjdsajinpmrrn...

output:

lxrgg`mnthrc`kqbzoljgstkkayvmovrpqfbjjwsvrqxhhfwkqkbnm`wthsfcwfxsvlpytjb`zktdmmnykarnnanoppxrefwhejyalpyrxgcmadedkagkbnfqfyelppdcxqtendvhtlthnvyobvzoelscn`zwbymmvfhmqxrgnlpwsfjbjfxcpegegadlytajrcoksql`d`m`hyodsepeskdmhxvcfxj`dhyz`bfamwnqaohbfpgsddzkfmjhfyxtkxethardoojjzaskrdebsenhvmltvzwbxsswengqqwz...

result:

ok 

Test #12:

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

input:

25 500
zzzzzzzzzzezzzzzyzzzyfzzzzzyzfzzzzzuzzzzzzzzyezezzzyzzzzzzzzzzzzzzzuzzzzzzzzfzzzzzzzyzzezfzzzzzzzzzzzzzzzzzzzzzzzfzzzzzzzzzzzzzzuzzzzzzzzzzzzzzzzzzzzuzzzzzzzzzzzyzzzzuzzzzzzzyyzzzzzzzzzzzzzzzzzfzzzzzzzzzzyzzzzyzzzzzzeezzzzzzzzzzyzzzzzzzyzezzzfefzuzzzzzzzzzzzzzuzfzzzzzzezzzfzzzzzzzzzzyuezzfzzz...

output:

qjtwjfaynbvccrdx`kye`idubqx`bidthnhseryxlaey`vbvdqg`jplbtulcjwhffjcsftewuqbxixoaeklq`fcvjiyeuthdcnfrqlwcoynrwjtxyinarlkxyfwkcjwxsqbcldqgnhuohjjbalwyasdpgxqdrbenw`yonrsplnurof``jjfkxwoqabotkkoatikpndnkqcqx`lpgg`anbphuvvttrwehopqg`kreelbd`yvrhgivicskkpqgklfpyytlsxixrlogyvqanirnpjbxexfd`svgfiepdgrsdfgd...

result:

ok 

Test #13:

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

input:

26 500
ffafffffafffffffffffffaaffaffffffffffffffffffffffffafffaffafffffffafffffffffffffffffffffffafaffffffffffafffffafffffffffafaffffffffffffffffffffaffffffffffffffffaffaffffffffffffffaffffffffffafffffafffaaffffffafafffafffffffffffffffaaffffffafffffffffffafffffffffffafffffafffffffaffffffffffafafffff...

output:

jwqgkmcwfmttddjkrgeiupgfkpfhchbnthnxduniuodldbwubupqebtfneqjtwbtbpfnjtbblwpkwpmlmjcbhtnethftfwbhspbcnjiqbhjwwqhlbijtwbifhqnunbnhulnhnemgnhrhujflhjhlplbeklebltcfuefibwgchwiujeenkfnjxitedgusfpxowsfcosffogyohkfifogrfrrcdskevggktsttffwnsowcfojjetdpkpytqcweovropxsrsrtxvkqryirsosgtjpjpgipmrftfcotxitpqfbci...

result:

ok 

Test #14:

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

input:

26 500
eeeeeeeeeeleleeeleeleelleelellelleeeleeeeeeeeeeeeeeeeeeeleeeeeeeleeleeeeelelleeelleeeleeeeeeeeeeeeeeeeeeleeeeeeeleeeeeellleeeeeeleleeeeeeleeeleeeeeeeeeeeeeeleeeeleeeeeeeeeeeeeellleleeeeeeeeeeelleleeeeeleleeleleeeeeeeeeeleeleeelelelleeeeeeleeeleeeeeeeeeeelleeeeeeeeeeeleeeeeleeeeleleeeeeeeellee...

output:

anwwzydgsgeaxgiaertejmxxudxcxeaeegyvertppdvrdzfksvijdayieapbbgaceyfebbbirkahxckchxvrbebwkwawkwffdrafprsghjdkbckgxrwpbkvxnhbjgkkikakjgvicihdwrnbtatpkrrdrftpceuboanckirrkadabpkbghxxihkcagspciscpxxousgwbdhynwdxshcicadawgayxygnbtgkmhrxnfjrootkjbrxbyogoojsidbhnordovpvvptbuomajjxtbstntxffimdmsmhxsvpkhntjp...

result:

ok 

Test #15:

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

input:

26 500
dddddddddddkddddddddddddddddddddkdddddkddddddddkddddkddddddkddddddddkdddkddddddddddddddddddddddddddddddddddkdddddddddkdkddddddddddddddddddddddddddkdddddddddddkdkkkddddddddddddddddddddkddkddddddddddddddddddddddddddddddddddddddddddddddkdddddddddddddddddkdkdddkddkdddkddddddkdddddddddddddkddddddd...

output:

jnjcyaxvcfiqncbrbhwifbjbcrmjvvfbsxnfcidjbbjbbyysxhiasrebchnbhjnuhcubshtndhpeiuvtjhmrjfnelyepxemtmtfeethicttdttcanxwhadlsvctemetayueenxucefhgjvtjvpqrrqwwvqtiquqidddcxwimewegtpnihipfppzdpgdirnrrpfrffffmrfqcjhpjicrfgaghgftnrmeffttpjmgjcdqtxcaqjnfmcgxvcxtdqshamdvnszamdjxeigmqcmlhwunpzcamasamfnmpsfswsthc...

result:

ok 

Test #16:

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

input:

2 1
s B

output:

`

result:

ok 

Test #17:

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

input:

5 3
idn BBY
mvh BBB
cva BBG
you BBB

output:

n`a

result:

ok 

Test #18:

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

input:

3 2
jt BB
bg BB

output:

``

result:

ok 

Test #19:

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

input:

4 8
jzhqnmbc BBBBBBBY
quubxmwq BBBBYBBB
zkmtxamf BBBYYBBB

output:

ctx`````

result:

ok 

Test #20:

score: -100
Runtime Error

input:

83 28
yyjekmbfltupxglbgnniupgrbbhh YYYYYYBYBBYYYYBBYYBBBBBYGBYY
gvgwlfkbriylbdfmajjupyijghxk GYYYBYYYYBYBBYBYYYBYYYBGBYYB
jjqnbpooxrfsqntbitwbgrplljzp YBYYYYBBYYYYBBBBBBYBYBBBBGBB
lqdozqobdhvzmtusczvxthcfvymz BYGBBBBYBYYBYBYYBBBYBYBYBYBB
tkhuvtpuhnmzphnqhpfzfsokewoh BYYYYBYBYYGBBBBYBBGBBYBBYYBB
gjer...

output:


result: