QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#660886#2141. Wheel of FortuneSorahISA#AC ✓31ms27536kbC++2311.8kb2024-10-20 13:49:452024-10-20 13:49:53

Judging History

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

  • [2024-10-20 13:49:53]
  • 评测
  • 测评结果:AC
  • 用时:31ms
  • 内存:27536kb
  • [2024-10-20 13:49:45]
  • 提交

answer

#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA

const int mod = 1'000'000'000'000'037;
const int P = 257;

void solve() {
    int L, N; cin >> L >> N;
    
    vector<string> strs(N);
    for (string &str : strs) cin >> str;
    
    vector<array<int, 26>> hashes(N);
    for (int i = 0; i < N; ++i) {
        for (int c = 0; c < 26; ++c) hashes[i][c] = 0;
        for (int p = 0; p < L; ++p) {
            int &meow = hashes[i][strs[i][p] - 'a'];
            meow = (meow * P + p) % mod + 1;
        }
    }
    
    using IT = vector<int>::iterator;
    
    bool flag = true;
    function<void(IT, IT, int)> recur = [&](IT it_bg, IT it_ed, int ban) {
        int n = distance(it_bg, it_ed), key = -1;
        if (n <= 1) return;
        
        vector<int> occ(26, 0);
        for (int c = 0; c < 26; ++c) { if (ban >> c & 1) occ[c] = -1; }
        for (IT it = it_bg; it != it_ed; it = next(it)) {
            for (int c = 0; c < 26; ++c) { if (hashes[*it][c] and ++occ[c] == n) key = c; }
        }
        if (key == -1) { flag = false; return; }
        sort(it_bg, it_ed, [&](int x, int y) { return hashes[x][key] < hashes[y][key]; });
        
        int new_ban = ban | (1 << key);
        int lst_hash = hashes[*it_bg][key];
        for (IT it = it_bg; it != it_ed; it = next(it)) {
            if (hashes[*it][key] != lst_hash) {
                recur(it_bg, it, new_ban), it_bg = it;
                lst_hash = hashes[*it][key];
            }
        }
        recur(it_bg, it_ed, new_ban);
    };
    vector<int> id(N); iota(ALL(id), 0);
    recur(ALL(id), 0);
    
    cout << (flag ? "YES" : "NO") << "\n";
}

int32_t main() {
    fastIO();
    
    int t = 1; // cin >> t;
    for (int _ = 1; _ <= t; ++_) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
    
    return 0;
}

#else

#ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
// #include <bits/extc++.h>
// #include <tr2/dynamic_bitset>

using i64 = long long;
using i128 = __int128;
#define int i64
using f80 = long double;
using f128 = __float128;
#define double f80
using pii = pair<int, int>;
template <typename T> using Prior = std::priority_queue<T>;
template <typename T> using prior = std::priority_queue<T, vector<T>, greater<T>>;

// #define X first
// #define Y second
#define eb emplace_back
#define ef emplace_front
#define ee emplace
#define pb pop_back
#define pf pop_front
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define SZ(x) ((int)(x).size())

// template <size_t D, typename T> struct Vec : vector<Vec<D-1, T>> {
//     static_assert(D >= 1, "Vector dimension must be greater than zero!");
//     template <typename... Args> Vec(int n = 0, Args... args) : vector<Vec<D-1, T>>(n, Vec<D-1, T>(args...)) {}
// };

// template <typename T> struct Vec<1, T> : vector<T> {
//     Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
// };

#ifdef local
#define fastIO() void()
#define debug(...) \
    _color.emplace_back("\u001b[31m"), \
    fprintf(stderr, "%sAt [%s], line %d: (%s) = ", _color.back().c_str(), __FUNCTION__, __LINE__, #__VA_ARGS__), \
    _do(__VA_ARGS__), _color.pop_back(), \
    fprintf(stderr, "%s", _color.back().c_str())
#define print(...) \
    fprintf(stdout, "%s", "\u001b[36m"), \
    _P(__VA_ARGS__), \
    fprintf(stdout, "%s", "\u001b[0m")

deque<string> _color{"\u001b[0m"};

template <typename T> concept is_string = is_same_v<T, string&> or is_same_v<T, const string&>;
template <typename T> concept is_iterable = requires (T _t) { begin(_t); };

template <typename T> inline void _print_err(T &&_t);
template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t);
template <size_t I, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &);
template <size_t I, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t);
template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu);

inline void _do() { cerr << "\n"; }
template <typename T> inline void _do(T &&_t) { _print_err(_t), cerr << "\n"; }
template <typename T, typename ...U> inline void _do(T &&_t, U &&..._u) { _print_err(_t), cerr << ", ", _do(_u...); }
#else
#define fastIO() cin.tie(0)->sync_with_stdio(0)
#define debug(...) void()
#define print(...) _P(__VA_ARGS__)
#endif

inline void _P() { cout << "\n"; }
template <typename T> inline void _P(T &&_t) { cout << _t << "\n"; }
template <typename T, typename ...U> inline void _P(T &&_t, U &&..._u) { cout << _t << " ", _P(_u...); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

inline int getRand(int L, int R) {
    if (L > R) swap(L, R);
    return (int)(rng() % ((uint64_t)R - L + 1) + L);
}

template <typename T, typename U> bool chmin(T &lhs, U rhs) { return lhs > rhs ? lhs = rhs, 1 : 0; }
template <typename T, typename U> bool chmax(T &lhs, U rhs) { return lhs < rhs ? lhs = rhs, 1 : 0; }

/// below are Fast I/O and _print_err templates ///

/*
/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///

#include <unistd.h>

const int S = 65536;

int OP = 0;
char OB[S];

inline char RC() {
    static char buf[S], *p = buf, *q = buf;
    return p == q and (q = (p = buf) + read(0, buf, S)) == buf ? -1 : *p++;
}

inline int RI() {
    static char c;
    int a;
    while (((c = RC()) < '0' or c > '9') and c != '-' and c != -1);
    if (c == '-') {
        a = 0;
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a -= c ^ '0';
    }
    else {
        a = c ^ '0';
        while ((c = RC()) >= '0' and c <= '9') a *= 10, a += c ^ '0';
    }
    return a;
}

inline void WI(int n, char c = '\n') {
    static char buf[20], p;
    if (n == 0) OB[OP++] = '0';
    p = 0;
    if (n < 0) {
        OB[OP++] = '-';
        while (n) buf[p++] = '0' - (n % 10), n /= 10;
    }
    else {
        while (n) buf[p++] = '0' + (n % 10), n /= 10;
    }
    for (--p; p >= 0; --p) OB[OP++] = buf[p];
    OB[OP++] = c;
    if (OP > S-20) write(1, OB, OP), OP = 0;
}

/// Fast I/O by FHVirus ///
/// https://fhvirus.github.io/blog/2020/fhvirus-io/ ///
*/

#ifdef local

template <typename T> inline void _print_err(T &&_t) { cerr << _t; }

template <typename T> inline void _print_err(T &&_t) requires is_iterable<T> and (not is_string<T>) {
    _color.emplace_back(_color.back()), ++_color.back()[3];
    cerr << _color.back() << "[";
    for (bool _first = true; auto &_x : _t) {
        if (!_first) cerr << ", ";
        _print_err(_x), _first = false;
    }
    cerr << "]" << (_color.pop_back(), _color.back());
}

template <typename T, typename U> ostream& operator << (ostream &os, const pair<T, U> &_tu) {
    _color.emplace_back(_color.back()), ++_color.back()[3];
    cerr << _color.back() << "(";
    _print_err(_tu.first), cerr << ", ", _print_err(_tu.second);
    cerr << ")" << (_color.pop_back(), _color.back());
    return os;
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(const tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(const tuple<U...> &_t) {
    if (!I) {
        _color.emplace_back(_color.back()), ++_color.back()[3];
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

template <size_t I = 0, typename ...U> inline typename enable_if<I == sizeof...(U), void>::type _print_err(tuple<U...> &) {
    cerr << ")" << (_color.pop_back(), _color.back());
}

template <size_t I = 0, typename ...U> inline typename enable_if<I <  sizeof...(U), void>::type _print_err(tuple<U...> &_t) {
    if (!I) {
        _color.emplace_back(_color.back()), ++_color.back()[3];
        cerr << _color.back();
    }
    cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}

#endif

#endif

/**
 *                                                                                                                 
 *                                                                                                                 
 *                                                                                                                 
 *                            iiiiii         iiiiiiiiii       iiiiiiiiiiiiii                                       
 *                       iiiiiiiiiiiii   iiiiiii    iiii    iiiiiiiiiiiiiii                          ii   iiii     
 *                    iiiiiiii     iiiiiiiii         iiii       iiii iii              iii          iiiiiiiiii      
 *                 iiiiiii          iiiiii           iiii    iiii   ii           iiiiiiiiii      iiii iiii         
 *               iiiiii            iiiii             iiii iiii        iii      iiii    iiiiiiiiiiiiiiiii  ii       
 *             iiiiii            iiiiiii            iiiiiii       iiiiiiii   iii    iiiiiiiiiiiiii iii  iiii       
 *           iiiiii             iiiiiii            iiiii   ii   iiii       iiiiiiiiiii iiii  iii iiii iiii      iii
 *          iiiii              iiiiiiii       ii        iiiii iiii    iiiiiiiii        iii iii  iii  iii  ii  iiii 
 *        iiiiii              iiiiiiii      iiiii     iiiii iiiiiiiiiiiiiiii         iii  iii  ii  iii  iii iiii   
 *       iiiii                 iiiiii     iiii     iiiiii iiiiiii    iii iii       iiii  ii   i   ii  iii  iii     
 *     iiiiii                            iiii  iiiiiiiiiiiiiii       iii iiii   iiiii  iii  ii  iii  iii  ii       
 *    iiiii                              iiiiiiii iiiiiiiiii       iiii   iiiiiiiii            ii  iii  ii         
 *   iiiii                                     iiiiii  iiii      iiiii              iii      ii   ii  i            
 * iiiiii                                  iiiiiiii   iiiii    iiiii                        ii  ii   ii            
 * iiiii                                iiii  iiii    iiiiiiiiiiii                             ii                  
 *  iii                              iiii   iiii       iiiiiiii                                                    
 *                                iiiii   iiii                                                                     
 *                              iiii     iiii                                                                      
 *                            iiii    iiiii                                                                        
 *                          iii     iiiii                                                                          
 *                        iii     iiiii                                                                            
 *                       iii   iiiiii                                                                              
 *                       iiiiiiiii                                                                                 
 *                       iiiiii                                                                                    
 *                                                                                                                 
 *                                                                                                                 
 *                                                                                                                 
**/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 2
hello
world

output:

YES

result:

ok answer is YES

Test #2:

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

input:

4 4
idea
play
game
warm

output:

YES

result:

ok answer is YES

Test #3:

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

input:

4 2
game
name

output:

NO

result:

ok answer is NO

Test #4:

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

input:

25 2
qwertyuiopasdfghjklzxcvbn
qwertyuiopasdfghjklzxcvbm

output:

NO

result:

ok answer is NO

Test #5:

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

input:

1 2
a
b

output:

NO

result:

ok answer is NO

Test #6:

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

input:

1 1
a

output:

YES

result:

ok answer is YES

Test #7:

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

input:

4 4
cada
bbbd
dcbb
dcdb

output:

YES

result:

ok answer is YES

Test #8:

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

input:

5 5
adecb
cdeaa
adcce
bdabd
cdaeb

output:

YES

result:

ok answer is YES

Test #9:

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

input:

1000 100
vbycgpycxwmgizifwpyivycyrbnjcsgthqykunyjdcmcrcfdruwnbgtgiafqycbeykxbokhgmvbropvzrodqmkvjtmzezbsvdkjzetrbjjglhmhxkhvthsgiwjesbtdtorthxzebbxrpywzewuxxqdciwoxoqyrakqcjaqyalotajczynooofyjvkeayvmpagfgrofhfpmjzdqzmczpporekgegdzfdneogiywsccewximkqhdrwtaxduywpiaxybmtjmdgfpaifgrghyzoijuuhjsqldrvjffx...

output:

YES

result:

ok answer is YES

Test #10:

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

input:

100000 1
gjmbwnyiyecuvnuawwrdpdelyaofogpginszgnjoxvywvtqptxjvjoejqeftseevpgqlletsqbvgozjxrglohowbeblzaynydpjdrfeynlrdajlmwbgcjlljtatjxyybhrriixhwwmxetpaihphprsvttliuvstgemkambvsqiiavmojbhqxdxgtqyoowxpvaxymzkonvwbkaikdvluwvaxgicqkqonayphhypgusmepscjwcqqvoyuznbtsexgxraxsnulxvxzybwmhwuqawgvemiplgguowgq...

output:

YES

result:

ok answer is YES

Test #11:

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

input:

4 25000
qtix
mfwq
fewc
nuoz
bkus
tjob
cjlx
feuy
vhdd
xkag
ejwq
lewv
srzh
pxwt
yrtp
dfdp
fxhk
tjay
bpmn
cwca
arpx
funa
uqog
fmfs
ifsa
gygz
mkjy
dnpv
fbrh
yvmc
uyim
kiax
gxpa
tbmr
ywqe
prty
bwrd
akcl
sjgy
wukk
bpti
fjiy
gjed
wjhp
oiqx
gbtr
utae
mnvr
yhak
wilj
nrqj
vwbz
xltu
nhkc
mgnx
poxg
xvly
lovs
ri...

output:

NO

result:

ok answer is NO

Test #12:

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

input:

10 10000
semrrqgeyq
laslsriuzc
fektrnjiau
udydynaymj
sxskejbmhh
vknzlaxawl
wzffusgfua
kmajyjubsn
dodzembftu
pqqgsyfiju
gqepvnciws
nygqjywieq
rkgcmcjmuj
dhzysexbva
rgdlvqmcgk
atcfasfsmh
iiiltzmpoy
ngucmoxczv
dqjxpgwfhw
opfkmzxnxc
jecolecvpi
welkwbnieg
oymduzlixy
pholhpbwza
iyujuzcfxc
dmkxccungv
kvgrm...

output:

NO

result:

ok answer is NO

Test #13:

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

input:

10 10000
fgihfcfhid
edcciacjae
aefibffifa
gfiaaagdaa
ccacabbdjb
fajbbddjhf
efhfidbghd
gababhfdid
cefhgfihfc
ebjagjiggj
gagaadbgib
gaeegghfej
begfiigdaa
djeigiicef
cebciaehda
fgddcgddbg
hdeaiadfhj
djjehfdhhg
fbgaecdeca
hhbghcibfh
hjfidgahhb
defeaehhcj
bibeddbgdb
gjfjeccdji
jiedgebhdi
efcdiacfbg
jaceh...

output:

NO

result:

ok answer is NO

Test #14:

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

input:

20 5000
bbbaaaabbaaaabbbbaaa
ababaabaaabbbbababba
aabbaaabaabbaabbbbab
aaaaaaaaabbabbbaaaab
abbabbaabaaaaaaaaaab
bbbaabaababaabbbabba
aabaaababaaaabbabbba
abbbbbabbbbbaaaabaab
aabaaaabbabbaaabbabb
bababaaaabbabaabaaab
babaaaaababbbbbbaaaa
bbbbabbbabbbbaabaaab
abaabaaabbbbaabaabba
baaabbbaabbbabbbabb...

output:

YES

result:

ok answer is YES

Test #15:

score: 0
Accepted
time: 15ms
memory: 27364kb

input:

10 100000
rditknzufp
mxlobxperf
aehzrkmdkl
ykxtgaqksl
wqhxjykaeg
vrdstmpfol
lbskmvesan
csasmfgfgc
wpncgfjdvi
ihsupukwqj
llgwyhhctw
wocklnxiun
zchhkswexq
kggbudufur
jvddrzwzab
zwtobyzvua
kpftzohdou
doinnwhmxh
qktkmgwcrh
monsmtwkzs
dfqzjlvyiq
anmnlnsmel
jycbklbhqg
ckghdtbpwf
pfuaiderfa
diieyrwqdo
mvxp...

output:

NO

result:

ok answer is NO

Test #16:

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

input:

10 100000
aaegbehgfe
fehcccfhdf
hhaegaccca
dgdgeeaehh
egggbahhha
caehcbadgh
geeedfebga
chfadfchbg
gbceheebfg
ahhcahbhfc
begdcedbdf
ahcgghghdf
fbgccedcfg
egeefahega
cbfbbbdhff
chbgecfdfg
afbbdacbfc
ceehcadacg
gadhfgefdb
ahhfdecdbc
ahgaffefha
efebadgdcb
adbfbebhcb
dghfabcbgb
edfbebcbfa
ffeecahdag
ehcg...

output:

NO

result:

ok answer is NO

Test #17:

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

input:

10 15
tzifuvwynt
iiiuejqjzg
iiiicfpkfe
piiikodfrl
qiillngncy
icdirodsvv
itillxjrqy
qumiyrjlex
iizicqgwst
iriihdtcxs
yirepnmnwg
wikiycjsju
iibxjzdrxn
rqiiggalkr
inwsevlurl

output:

YES

result:

ok answer is YES

Test #18:

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

input:

10 215
mzzrnjgojt
zzdzuianwb
rtuxdoimxw
zfgmeybxdl
tzzztajbus
zozzejwrci
dtzzgxbbho
yzznoteska
zzalgupljq
zibzqwkutj
wbzttdtnur
buvnqsmyjw
lzzzypmauw
mzzwxbaocw
znigxkfikm
qzzeejltkg
zvizxqgukl
mzzzbbauut
pzgwmqdcee
wqzjviidhr
lzzzoqlmhx
usgoccliem
zyzzubdenw
zirldxwwmm
zxisttviij
umwzwknurn
zyzqnaq...

output:

NO

result:

ok answer is NO

Test #19:

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

input:

50 1023
rlikiakkkkllqlhhhaonnpeqtyonagizrbhwqjmuauhwsbditf
kshkjkkkzktcpqvzmqqviuqjytfomyoyenpiyoqcwbzrblnniu
kikjkukdzngyocswdclvuwhqquizlilioaexxxoiijstodbnau
anxphbmkqkjeylasslrlilipynsldbyrudhoeaciququmwwpvv
mkdkgkkzeknnpduhnxzarfqvnjgjvglddfbffsgcmuszewondy
karnrekkdkpzstmouqwezesypduwefoqizygi...

output:

YES

result:

ok answer is YES

Test #20:

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

input:

50 1523
llllllobdlacxrmmxmivivzmexhsgkckdofbapaqupnsbegayo
zfellxllfmaeudgusbrjgqtiuwnvkeyguttuqmpjuenwpbxkck
kgtchiplplbftahetnnukkifbrbdurnapvwtgnwfsponwtjmjj
llnelhqlllobuagjncxezkgtuwdhxuhqqanyrzpgmakxqkzjat
ilalaollrlbeyfkeobrmkyyqonzfbxwuiaqfiieabsguwubrte
fcledlllalbydyucfcfikpqetapdtzrdhxvjb...

output:

YES

result:

ok answer is YES

Test #21:

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

input:

50 6023
faurwatlclrziupnmveztgaxtsfzjzvpacdujyjsfmndexbesn
nplldowbcazizuutevfoundzmynzodzgjbesjgztrankxtvvrz
lellllfltlzuarmstfvdzvcwfhkfrfeskqjinqdkwnvybhyavu
lzelglllvlsugtskiemctamwmacayrckiozoszusgfuezeuwqr
llllllklmldinizxciwuegejzhkofgdugahoxivtisettkjskq
ejlillxgllszpdwrbxfpvbsxtjiswnbrtbqtz...

output:

NO

result:

ok answer is NO

Test #22:

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

input:

15 32767
gwggqsoghiqdigg
ocgsdggpgmgtgig
pcqrsgygggqggfg
ggpgoxgggxoubsg
aggaghggggwggge
vggtygggggtdugg
egjghcgxgggqgxg
qmgudjtgjgvgwiu
gcjaggkoagyrcgo
ghgzygbazhgggco
ggfgnggguidgggb
ggeggecgjgcjhaq
gogylcwggygdwgb
glggmogggeguegg
kwbleqsmgiivntj
ggggrxehggysogb
ggggugbgagggggg
gggumgggtxgkltg
geg...

output:

YES

result:

ok answer is YES

Test #23:

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

input:

15 32777
ooyiwfnixldkopo
ofodooomoigooov
ybfoooozogxomcw
vboljwoomoaossj
yooovjoitooouyg
loooroojdoobczo
ooooozkrooooojo
oldopeoyohosfos
joofooaoofhesoo
oybovoooospgoko
oboeoooboofovof
oobeonoogsovoyy
rooxoozoooohvjy
ogemtpooohjoeov
okoooooooyoxotv
wofoosogooxohoo
ooogzkoifobimcv
oojojoojognwqoo
oio...

output:

NO

result:

ok answer is NO

Test #24:

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

input:

15 16383
vtfyyvjabftvttd
tlvtfttttbtlruw
ytboqdttyfqkerr
ttrtztvaswtxtcl
fmanttcvtfvsttu
fntqdjsbmtbqjgu
tttqtrttthttktf
intutjvztvnftsc
tuttmtttttymati
tatttklrtktbufd
ttttttttttemttj
lqtptnntletotkd
tttttieetttxttu
tttthitxtktldtq
tztttgttwztqitj
tgcttttttyludfz
ftubtftbttitftv
tttttttivtcthtm
vtt...

output:

YES

result:

ok answer is YES

Test #25:

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

input:

15 18183
tuataltkuottjto
ttvztyrttttntts
uttfalttitttttu
ttbthrttltttftw
tzvttsttxotttan
ttmtgttzttbttfh
thkvtttctttttqo
tbuectaitketpdk
nxivccttktfadce
dbtvtftxtmtttbh
tbsrttrzjjbzmtv
waptsetxtttttma
siustthtrettttb
tuwmtpwjvtttwtn
ldtqctjtttwvthb
eyttttttitxraon
texltxgtttttcij
tvtvtottttttdtv
gtj...

output:

NO

result:

ok answer is NO

Test #26:

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

input:

15 23383
ztabbbbhzqbabbg
xbfbpylbgeexjju
bpbxfbvbuikzybh
tkabybtgbbbzmbm
bbbobbbbbbbdbbv
mbtbfubjbtnbwly
bnbbbbbbbbbbfmi
bbmbebbsqwdbbbi
eobmwjbbekfbbbc
bdbbborrbbwbqti
rmfdylbpaksbunh
izllibeybubrbjh
yfhbsbbrbkbbeue
nbbbrayrrbwnbbc
hbbybbmbbbbrpbn
sbbbllodbbnkglw
byzyobtimbkbquc
iubajdbbebbqgzi
bcb...

output:

NO

result:

ok answer is NO

Test #27:

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

input:

15 26383
udbbdbbbbbboboj
xxbkbbapbtbcbbm
abhbbbtbfbbabse
boabpebgbvbobbu
cbbkbfgcbubvpbw
bkbbobbbbbktubm
jbzbbbnbbfsbbwd
xgnnsbbbqybkbbx
bnbfbqvybrblrbs
lbiumbbbbcvfbbr
btlzvrzbowbbbrd
bchgbgffwbbtwqg
bbbbvbokbbxbxzx
bbbubbbrbbdbbvr
bhbbymbekbbbbbe
bvsbrfouftbwuba
bqambqbiebaocbr
bkbbbjbzbbubpbn
bka...

output:

NO

result:

ok answer is NO

Test #28:

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

input:

20 16383
rfcoepdlhpakppymgwag
xpppppsspppvppgoowfd
prpypeppppopkqzsqclk
uqvzkpfpqpppppjnykma
pxpomphjlpphsulvqajo
pspcpytwppppppojarcm
pppvpeppqvppppjwfoni
pucpwppgugfpppqdmrsn
pypyapppppspfmfloiql
daopgmpepgtperfxbqyg
opppbgntpypkxcegxgfk
plrppkwyowqtppwvkdbr
pppppdpqpkppppfswhoj
ppripdprhnfupkqbud...

output:

YES

result:

ok answer is YES

Test #29:

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

input:

20 18383
ijttwtttrztxenwraglv
tttprttttvitttwsbavn
tttvmsttttttttddnrrw
tdttulvtbtetttypdllk
ttuttrlnttttfnnxhsjm
ttquttmxthttmiufboku
ntvhtpbqtykthtvpzpgk
ttetectwtttvooykmqde
vittbtttctzbytiuyynv
ttwtttwgpctrttramnmh
ttykjttstttmatpscdln
otmostycetttttpudgnq
trtttkrtcxttttcnmhki
eawjtctttojstthrnb...

output:

NO

result:

ok answer is NO

Test #30:

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

input:

20 18983
fjfnjfffflffgfxromtn
fflfkfffffdzkfwemloi
fffuowfifdffffjdvxym
vffffffubfimffynpmtl
yhfifhqffauzpfqpaiva
oeeefffefqmfsfcywrgg
yfwffnhiffafffcrpvog
fsfiffffffoynektqtrl
qffffhiffcfbfknkncgs
ffdfukfrnqqfxhtsszuw
fofldkffflffegzyppbe
vffufjfzfrfaffphrecm
ffffjxfffbffuftgezsx
srojffmwffmffthlvm...

output:

NO

result:

ok answer is NO

Test #31:

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

input:

40 16383
tetttttwhactqtwzoroxobnxnaoiwkrczhxoqlwu
fbdettwttttzttdlefqjwlbcaqpmzzxkmipgbyra
fhntbqtftwtttfgaopkwscqzmcsmvspezwcqgqqb
tqbgttuxuwsdttpbieygjeurrbxuaprnfujopuyn
rxtuttsmqtmstbyoeujriijqbqmknnblnljnllgo
wetjtttwthjstwssxekmjpklaghgbymscpuvevpb
otttfotwwttmtohaqazjcjlwakcoxcpnrxqliwmn
ayvt...

output:

YES

result:

ok answer is YES

Test #32:

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

input:

40 18383
qqnqqqoqcmoqqqjagisjwijgdonahishfwikgwki
qqqwuqixxqqqqhswirbpmfdosatrnirdfilhkkek
qkjkqsqqqqkqcemdaxigciuvtuyfglfdlteyexvb
qszvxknhqdqqilpcjixcfhedkxwyvhovobrnycha
qqqjqdhqqqqqlqotgotgntzfktxhasxbyrwcyrgg
bitqftkzdxolrnffzogrsyphrepjboynmiyedkul
qcqqqqidagwfhzbzhjdikmvunkopaykdsbsetcmh
mqxq...

output:

YES

result:

ok answer is YES

Test #33:

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

input:

40 24383
tidnpnnnvynnwlbsikmjkicyzujpreejohvhxift
nrnnnncnontnnaovuerizcvzeockwyculxsgezih
nnnolllkannpnertehuktrmsddrvjvcdigozrstw
nnnnreqeuwlionefbvauqdytlvfojbsztaoooubr
enfnsnnspnnznkdopvqlokgtlvcoxpbpohiygyfg
vnqckthfnnzcnnyzqkkskfyuxctobreftgklmixr
utnninnusnnnnhbccxtrlrihequjfizmkkhjscks
nnfn...

output:

YES

result:

ok answer is YES

Test #34:

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

input:

26 27
goqggehggzgvbgjxnumgarfitg
ooqooehoozovoojoouoooooooo
woqgyehkpzlvbcjxnumsarfitk
hhhhhhhhhzhhhhjhhuhhhhhhhh
jjjjjjjjjjjjjjjjjjjjjjjjjj
roqrrehrrzrvrrjrrurrrrrrrr
woqgyehspzlvbcjxnumsarfits
zzzzzzzzzzzzzzjzzuzzzzzzzz
woqgyehdpzlvbcjxnumsarfitk
eeeeeeheezeeeejeeueeeeeeee
loqgyehlpzlvbcjxnumlarfi...

output:

YES

result:

ok answer is YES

Test #35:

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

input:

26 31
nnnnnnnctnnuninnnnnnnonnnn
kzjqmnwctvxupiewydfsaolgrb
kzjqmnwctvxupiegydfsaolwrb
kzjqmnyctvxupiyyydfsaolyrb
kzjqmnectvxupieeydfsaolerb
mmmmmnmctmmumimmmmmmmommmb
jzjjmnjctjxujijjjdjjjoljjb
kzjqmnqctvxuqiqqqdqsaolqrb
vzjvmnvctvxuvivvvdvvvolvvb
cccccccctccucicccccccocccc
xxxxmnxctxxuxixxxdxxxoxx...

output:

NO

result:

ok answer is NO

Test #36:

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

input:

31 151
npytmufdacqolcrirhsjbwrkxezrgrv
npytmufdarqolcrirhsjbwrkxezcgrv
npytmufdacqolrcichsjbwckxezcgrv
npytmufdacqolcrichsjbwckxezcgcv
npytmufdarqolcrichsjbwckxezcgrv
npytmufdarqolcrichsjbwckxezcgcv
npytmufdarqolccirhsjbwrkxezcgcv
spytsufdassolssissssbwskxessssv
npytmufdacqolrrirhsjbwckxezrgrv
npytm...

output:

YES

result:

ok answer is YES

Test #37:

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

input:

31 279
xzwgqoggupnggmsgvgetggajgyhgggi
xzwdqoffupnffmskvgetrfajfyhrlci
xzwdqofrupnffmskvgetrfajfyhflci
xzwdqofrupnrfmskvgetrrajfyhflci
xzwdqorfupnrfmskvgetffajryhflci
xzwdqoffupnrrmskvgetfrajfyhflci
xzwdqoffupnrfmskvgetfrajfyhrlci
xzwdqorrupnrrmskvgetfrajfyhrlci
xzwdqoffupnfrmskvgetrfajfyhrlci
mzwmq...

output:

NO

result:

ok answer is NO

Test #38:

score: 0
Accepted
time: 24ms
memory: 8112kb

input:

38 16407
cajjnbjvjqjfidoulynwjngtjzkespxjrmnhjj
canjjbnvnqjfidoulynwnngtnzkespxjrmjhjn
canjnbjvnqnfidoulynwjngtjzkespxjrmjhnj
cannnbnvjqjfidoulyjwjjgtjzkespxjrmnhnj
cajjnbjvnqnfidoulyjwnngtjzkespxjrmnhjn
canjnbnvnqjfidoulynwnjgtnzkespxjrmnhjj
cajnjbjvnqnfidoulyjwnngtjzkespxnrmnhnj
canjnbjvnqnfidouly...

output:

YES

result:

ok answer is YES

Test #39:

score: 0
Accepted
time: 23ms
memory: 8044kb

input:

37 16407
caffqftsrlffkmnbexpfjgvfpffoifuhfywpd
cappqftsrlffkmnbexpfjgvpppfoifuhfywpd
cafpqptsrlffkmnbexffjgvpfpfoipuhpywfd
capfqftsrlffkmnbexfpjgvppffoifuhfywpd
caffqptsrlffkmnbexppjgvpffpoipuhfywfd
cafpqftsrlfpkmnbexffjgvppffoifuhpywpd
caffqftsrlpfkmnbexffjgvfffpoipuhpywfd
cappqptsrlppkmnbexppjgvpf...

output:

NO

result:

ok answer is NO

Test #40:

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

input:

10 512
hnpesmfkjq
jrlonipqgs
gnperklmis
jhqfsodgmk
grneqljois
flpgsnjkiq
gpnerlhojs
gnpesmhikq
gpoerljmis
hlqfsodkjm
jhpernfgls
jfphrndels
hpnisljogq
fpogrljmis
hpoesmfkjq
jfphrnecls
jpokrhlmis
hlpisnjkgq
ipogsmeckq
hrlmqjnogs
nrkomipqgs
fpoisljmhq
glqesnhiko
lrjmohpqks
hjpernfils
inpgrmecks
jrnkqhl...

output:

YES

result:

ok answer is YES

Test #41:

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

input:

10 513
fhqsrdjkom
girspekcom
ehsqpfjkom
gfsqpjimol
ehsqlfkipn
egqsrhkiom
ehsmjfliqo
gismjdleqo
gfsonjikqm
gfsqplionk
mjsqpngoli
mjqsrniolh
egsqnjimpl
egsqjhlipn
egqsrjionl
gfrspjionl
gfrsnhjmpl
kjsqplgmoi
gisqpekcom
fhqsrdkiom
egqsrniomk
mlpsrnkqjh
eirslfkgpn
egrsphjonl
girsndkepm
onmsrpgqki
ifpsrjh...

output:

NO

result:

ok answer is NO

Test #42:

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

input:

512 512
ssrsprssssrrrrssssrrrsrsssrsrrsrrosorosrppsskjrssorssssspssrsrsprnrsppsssssrmosssssosnrsspssosssnosrsrpsspssrspsssrsspossorspsprrsssnpssosrsssrosrrssrprspssornrrsrssssoornrsorkpsmssmsrrnppspnsjsprsrspsprssssrropsssrprpprsorrspssssgsssorsppsssrssrsrspsmsposnrspsrsprsspskpspsrpsssspsnsspsrrsrr...

output:

YES

result:

ok answer is YES

Test #43:

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

input:

512 513
sssssqmqsssqsmpmsqsqkssspsqsqssoiskssspqqmiqssqsospspsssqsqsssqqssqqqiqosssissspsssssmsqsqsqssqpssossmqqsssksqssmqqpopsqqqsspsmqpqpqqdsqsssmpsssqsqsssokssssqqpokpsssqqsssososppsqoqqqqqqspsssspspqssqssossspsssqssqssoqspssqqqsssppssqpssspsskssksosoqqoqepsqspssqsppssssspsqqpsmpqspsqsgpsmssssssq...

output:

NO

result:

ok answer is NO

Test #44:

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

input:

13 4096
tynwqoxrlpmus
pyjxmkrnvltqo
tymvkixrqjows
tymvikxnrhpws
jwrygpnhvltmi
runykitlwjqso
tyoxgkvlsiqum
twlyomvrqnkus
pwoygmvjuirsk
lupyintgwkrse
pynxikrlvhtqo
psmygkrnwiuqo
lwpyintjvhsqk
pymwkjxnthruo
tynvhlxfsjpwq
nupyglthwjsqm
ryowkjxluhqsm
pwoygmvhujrsk
tylvmjxrqhows
rymwgkxptiouq
jqsyipnfwmuk...

output:

YES

result:

ok answer is YES

Test #45:

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

input:

13 4097
kouiyvxpglnsq
ksrlwvytopjnu
oiumyxwjhfqsk
lmujyvxpghosq
nkwiqpylgjsuo
jouhyvxpknmsq
nivlyrxjhfqto
mivkypxnhfrto
koshyxuvilnqw
jothyxvrknmqw
nevkytxligqso
lsrhyxvtijnpw
nevlwtyjigpsq
lquiyvxrgjnps
muoryxqvstjlw
nkvjypxlghrto
lmvjwtyphfors
ofumyvxdkhqsi
ogwlqpyhjfsum
lmviytxpgjors
iowlsrypmnku...

output:

NO

result:

ok answer is NO

Test #46:

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

input:

10 512
giaekbfhcj
iajdefcbgk
gijeadcbhk
afjckidbhg
gacebihjdk
fhagkicbdj
djceaigbhk
diaekbcghj
gjbeachidk
gajfkidbch
gfjeaicbhk
gejfaidbhk
eacdkihbgj
fjbgachidk
gabekifhcj
gejfaibchk
ejbdahcifk
ehadkicbgj
gabfkiechj
haedbicjgk
eajdficbgk
fabdkchiej
dhjekacgbi
eagjdhcbfk
cgjeaifbhk
gijfabechk
eacdbhi...

output:

YES

result:

ok answer is YES

Test #47:

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

input:

10 513
fgbkadchji
fgakjehcbi
egkjafchbi
gfkjahdibc
eckjhfbgai
edbkachgji
eckhgfabji
fbkhgdaeji
gfkiacdhjb
gfkjaihbcd
dikjacgbef
dibkacfjeh
egkjihdbac
edkjgchbai
egbkahdjci
gfakjhdbci
dfakighbjc
dekjacgibf
fgkjaehcbi
fcbkadhgji
egbkachjdi
deckajfbgh
egakhcbfji
edakjghbci
fgakidhejb
defkacgbji
dfckahe...

output:

NO

result:

ok answer is NO

Test #48:

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

input:

512 512
kkakjakkkkaaaakkkkaaakakkkakaakaabkbabkajjkkieakkbakkkkkjkkakakjacakjjkkkkkadbkkkkkbkcakkjkkbkkkcbkakajkkjkkakjkkkakkjbkkbakjkjaakkkcjkkbkakkkabkaakkajakjkkbacaakakkkkbbacakbaijkdkkdkaacjjkjckekjakakjkjakkkkaabjkkkajajjakbaakjkkkkgkkkbakjjkkkakkakakjkdkjbkcakjkakjakkjkijkjkajkkkkjkckkjkaakaa...

output:

YES

result:

ok answer is YES

Test #49:

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

input:

512 513
kkkkkjijkkkjkiaikjkjhkkkakjkjkkbgkhkkkajjigjkkjkbkakakkkjkjkkkjjkkjjjgjbkkkgkkkakkkkkikjkjkjkkjakkbkkijjkkkhkjkkijjabakjjjkkakijajajjdkjkkkiakkkjkjkkkbhkkkkjjabhakkkjjkkkbkbkaakjbjjjjjjkakkkkakajkkjkkbkkkakkkjkkjkkbjkakkjjjkkkaakkjakkkakkhkkhkbkbjjbjeakjkakkjkaakkkkkakjjakiajkakjkfakikkkkkkj...

output:

NO

result:

ok answer is NO

Test #50:

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

input:

13 4096
cnibfhaelgjmd
cnjafhkemglbd
mnkcjiaefglbd
mnfcijakehlbd
hmkngjieaclbd
clenfiajmgdbk
cnkagfmedilbj
cminlhaefgkbd
kmdngjaebfcli
ilknhjagmdcbe
cneaifkjmhlbd
ckfngjaemilbd
imcnfjleahbkd
knfbjgaechlmd
mnkchjafdiebl
jlcngeahmibkd
cnkbfgaemhdlj
kmdngjahbecli
mngckjaefhlbd
lnkbgjaecifmd
cjkndaifmblh...

output:

YES

result:

ok answer is YES

Test #51:

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

input:

13 4097
fdbinmacgjelk
hdekmancfljgb
jdminabcefklh
ejbinmacghdlk
cdmfjanigeklb
gdbhnmacjeflk
cdminkahefblj
dhminjacefklb
fkmhnadcijelb
gkmhnacljefdb
cemdnlaihgkbj
jdehnacmfiklb
jeaimlnhdgcbk
jdbfnmacgikel
ldmgnahcfejib
cdmenjaighklb
ejaimlnkhfdcb
jfbinmadhcklg
bdmcjanghfkli
ejmfnlakgidcb
idmgkancfehl...

output:

NO

result:

ok answer is NO

Test #52:

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

input:

16 32768
kbomngpfiadqjhlc
piomcdbenhkqafgl
qiomnlpebhkdafgc
qhegfdcnbilapmko
ojadnlpkbghqmfec
oeamndpfkciqlhbj
qjcgdmpeokhbafln
qiodnkpebhgamflc
qjomnkdibefcaglp
mgoanjpebdhqkflc
qhfmjopebigdankc
piocnjbemkgqafdl
qjdmenclbkiapgfo
plghndcebjmqafio
phefndambjkqolgc
qjdmenblokiapgfc
qiofndembgjcaklp
qi...

output:

YES

result:

ok answer is YES

Test #53:

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

input:

16 32769
lmngfcbopkahdjeq
ldniepjhofacbkmq
bgnihpkclfqjodam
djchfablniqeokmp
ldfhiebcanqjokmp
ldejfpbcakqiogmn
longfpbcakdhejmq
licegbnjphadokmq
bdnicphglfqjokam
jdigfpbcneahomlq
ldbfgpmkniajoecq
dkngfpbcleahojmq
gnejfdbcalqiokmp
lenicphgjdqboamk
kdhgfpbnaecmoijq
gdnkfcpmalbhojeq
hdnglcbmpeakojfq
ld...

output:

NO

result:

ok answer is NO

Test #54:

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

input:

1000000 1
clvjbkticbvcfkkkbherajrgntafpfbssakkoojpbnctjhksjrbesgasagwqhjbsuhofsattktwecuoislfcppnejortgpfapjibhmpwtnartgcrsnicwsdpikomiccqcjkqgottgsttjteawfqnfforuqhmsqgglriuiiathntnbckllqfvsurtkougrtjkcqopabwfalticbpafqgdshtcierffmldamiunjfmakbkdqflvnerhucsprboruapdaphmanqeeeljwgfcrvduwjwimcebtkmbt...

output:

YES

result:

ok answer is YES

Test #55:

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

input:

500000 2
ndvodjlqqfahowkkobeqlcbrpmioinveruimhjarsfvadinqmtoksrfeincrwkckprohjnemwmhvlklqfwbjrpjggvmrqhkogabkomtrlefjgbmfprhghetgpkdskstlcadqccruipebihgisnisrninictfctqlvtfvgukmvkudmwhaqamnskbvfpimdbmndlqfrtmvhvpsgeehdmfoenbbtwgcjalqkgubgmiossiwedcbrjocfupeaiqqgwkiwhwvsipouttvdmqafmjasggiovmwrmknqej...

output:

NO

result:

ok answer is NO

Test #56:

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

input:

250000 3
nslfjowdtaailstwiqnbsfropqfacbubpalsdqtnaudvhrplthdidkgcpmqhucowijtqgeftppgplegvtluklwlihwoqtltsmnkndkjiiwibqwhttdmffqfomwjhutvwsafegihdgvrdnlpjpuloiieqcfkwofusvfueeqhopvpwkhpmtlbmvakcfpfdkaaeusprpfqsmnerpvierkktkpfbblkugokdtvfbuqdltnqcfmrkocuaibroppfwnnaqppqqdgqnlmatvrkudiwmotshrqfllwrllmg...

output:

YES

result:

ok answer is YES

Test #57:

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

input:

250000 4
mkqjeqepmkkivjmfpbumelmmhlkahhtoajwajmtfbdpppciapqrcfswdsdsouofptpisfqoqmnovthvbjptighlleeckkkqkjbppemfnqnfsdkolaejnkblthrfdncirrntbcnecmmvphhlojpspfdckgpvgqvmcljusulhkrrkskhnrtjsdmcvvrbkcsfekjvdlilwquhklfbhalenbjflpjcanvwwwvenjjckkrcevpfocwoebvlbjsvmpmfsjulemaqrcetpdloiwktfkfkvsmamvftuqeif...

output:

NO

result:

ok answer is NO

Test #58:

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

input:

100000 7
ksdtdprksvsvgmodtfrgjbfobqklrvbcakctrjslvrlodnwfqktrljujpifmrdklmpwshddidplkbbwuwutsgghvcgnqfiscphovdvbkrisrtsfqaubjedtfffreeaosoeptwifjeaaerieufedaaqpnrfrulvdejpqplwwergioivieisaurslowivrkaorssranvsulvchkmmpucgqbjpbmrvakpgadalwhjvsrblokcduqnbpnqunctveqvaotvgjpippcmoeuiiakqelhomfrwnqfmvfkeo...

output:

YES

result:

ok answer is YES

Test #59:

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

input:

100000 8
wntgmqqoearowqpwjuiqfgalbutkgsgvssgfvsrohbniridtvressbjtdvmtrkjammlckokltswjhffebflntpkrlalpwkmifjgpaultfecjjpvndhvrsfbtpwcquthagemjfmupdglaqsceegbetolftkvehduoikaqsqdermatlhiovcgrhseoqfocrvdclhqilhkrdrguqeaktugbnpdcqucielrvrfdvvtmqucijfcgmrlhiofdoifdvtuqgvbqghmevtgesmquicfcvlbngcusrktifqrd...

output:

NO

result:

ok answer is NO

Test #60:

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

input:

666 1023
vevffaymhchdvgbicwpcdujtlrfbokvtutgasahvotseotludnfikwtpsnnjkiccmievtduqlkqqwgghoobwkrittqxhfhypitgphmttukvbclffjepniqtgcpkiuneimpfidsohjruoidjcrtdbxebridvbnnjckpohfselkfiphwiutlpnuadhkcrvuicgbjnmptruiemoqiewtlnjmrwletmsgtgqeisashjvcdafxvkcfefmimvrbbkkqmwqotpshrenwcuivvceciqbnkeknuoshkqkcmn...

output:

YES

result:

ok answer is YES

Test #61:

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

input:

777 1030
mbatjrkgajduyqpsepgvavajjlafsvdsivvoattfhmheuphalohjqbauqaehfdlgyubirtibfjgppautubtwiimpswhhkqtpgvvsjsslvdtvilikcjwqvdohgeskhwyrengeivfwthdtlndlnepdgpnjtcbmgconoqjnvpvkbvodrfdnieqrujseashorpwejvieasigmdujnumfwqiobhcqqwlwftvuewgahhnbursvximlnaldoerbslhfflwspuqfrlmpdopeqkhxjhsqjvamfdweqwjaalo...

output:

NO

result:

ok answer is NO