QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#338635 | #6562. First Last | SorahISA | AC ✓ | 1ms | 3932kb | C++23 | 9.1kb | 2024-02-26 05:26:30 | 2024-02-26 05:26:31 |
Judging History
answer
#ifndef SorahISA
#define SorahISA
#include SorahISA __FILE__ SorahISA
const int sigma = 26;
void solve() {
int N; cin >> N;
vector<string> words(N);
bitset<sigma> is_end;
vector _adj(sigma+1, vector<int>(sigma+1, 0));
for (string &str : words) {
cin >> str;
is_end[str[0] - 'a'] = is_end[str.back() - 'a'] = 1;
++_adj[str[0] - 'a'][str.back() - 'a'];
}
array<int, 3> id{sigma, sigma, sigma};
for (int i = sigma-1; i >= 0; --i) {
if (is_end[i]) id[0] = id[1], id[1] = id[2], id[2] = i;
}
// debug(id);
vector adj{
vector{_adj[id[0]][id[0]] & 1, _adj[id[0]][id[1]], _adj[id[0]][id[2]]},
vector{_adj[id[1]][id[0]], _adj[id[1]][id[1]] & 1, _adj[id[1]][id[2]]},
vector{_adj[id[2]][id[0]], _adj[id[2]][id[1]], _adj[id[2]][id[2]] & 1},
};
for (auto [a, b] : list<pii>{{0, 1}, {0, 2}, {1, 2}}) {
int tmp = min(adj[a][b], adj[b][a]);
adj[a][b] -= tmp, adj[b][a] -= tmp;
}
// debug(adj[0]);
// debug(adj[1]);
// debug(adj[2]);
map<pair<vector<vector<int>>, int>, bool> state;
function<bool(vector<vector<int>>&, int)> recur = [&](vector<vector<int>> &G, int now) -> bool {
if (state.contains({G, now})) return state[{G, now}];
bool flag = false;
for (int x : {0, 1, 2}) {
if (G[now][x]) {
--G[now][x];
flag |= !recur(G, x);
++G[now][x];
}
}
// debug(G, now, flag);
return state[{G, now}] = flag;
};
for (int x : {0, 1, 2}) recur(adj, x);
int ans = 0;
for (int i : {0, 1, 2}) for (int j : {0, 1, 2}) {
if (adj[i][j]) {
--adj[i][j];
if (!recur(adj, j)) ans += _adj[id[i]][id[j]]; //, debug(i, j, _adj[id[i]][id[j]]);
++adj[i][j];
}
else {
++adj[j][i];
if (!recur(adj, j)) ans += _adj[id[i]][id[j]]; //, debug(i, j, _adj[id[i]][id[j]]);
--adj[j][i];
}
}
print(ans);
}
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;
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) {}
};
template <class F>
inline constexpr decltype(auto) lambda_fix(F&& f) {
return [f = std::forward<F>(f)](auto&&... args) {
return f(f, std::forward<decltype(args)>(args)...);
};
}
#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() ios_base::sync_with_stdio(0), cin.tie(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>) {
string _tmp_color = _color.back();
++_tmp_color[3], _color.emplace_back(_tmp_color);
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) {
string _tmp_color = _color.back();
++_tmp_color[3], _color.emplace_back(_tmp_color);
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) {
string _tmp_color = _color.back();
++_tmp_color[3], _color.emplace_back(_tmp_color);
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) {
string _tmp_color = _color.back();
++_tmp_color[3], _color.emplace_back(_tmp_color);
cerr << _color.back();
}
cerr << (I ? ", " : "("), _print_err(get<I>(_t)), _print_err<I+1, U...>(_t);
}
#endif
#endif
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
3 attic climb alpha
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
22 agora alpha antic aorta apnea arena aroma attic basic blurb china circa civic climb cobra cocoa comic comma conic crumb cubic cynic
output:
6
result:
ok single line: '6'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
3 ccabaabbba acbbbacccb ccccccacba
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
11 mraa myga vtwm mala vvgm atvv vusm mznv avea atfv amgv
output:
7
result:
ok single line: '7'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
1000 vznwivhoprv pvzcjyruxv phykv vozinczup vbp vgjxfotuhzhobfp pbv vygphslv vpnqrfep vzrphpfggoqcgv vgdjmzuckyedpnp vatmaxfp ppnmmwtqmv paawwp pspoycv vcjthv ppcvagp pteiqdonkklp vav vcsxv priqwbalidav vinp phqeijnqkgbxv pwvmbivmgvouv vwzhndzmqpcwkmp pyzlv vtvblfov vrdv vzrfmjdnaruwp pfup pwzv vwyv...
output:
478
result:
ok single line: '478'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
1000 rlp pgscawiivpjndlp pxr ruzutr pqdhfniemqvvr rvar rp prarwp pkuinxempbmear rupxuanwlvawmr pp rzfvr rcsxoyirp pgpilljr pogeizvqlr rajolbgzswur rcap ryzqymwr rrpp rbxtr rfldblbesyhqr rjidcekyrir pqrycftr rftwgmmakykkmep pehkxkayuip pguxsgtuikvp rtxmynvoolrp pzmsljlpcr phcfdr plaop rydojaccp pzfr ...
output:
246
result:
ok single line: '246'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1000 ffn fgikjn fwtakdbjn fsjnfzzn feqmuasubirsf faypin fcsdhfjvncfzsn nbcmvxemkan ngoqtaaon nlovkxxrbn fhdqkltoxvif fxpnqbguftsrhff fyniukvsmlf fibwbqckjpojglf nwcvf fxgeivnakggcn nn fkghlusecf neuwdafrkzptwf fcxn ff nlkxtn fdlsijtpbcjjcbn frlcjjnpsn ntyabhf nvf fdlmlhebidazhn fjn fstxgnmfof fqhusf...
output:
496
result:
ok single line: '496'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
15 adb bdc cda aeb bec cea afb bfc cfa agb bgc cga ahb bhc cha
output:
15
result:
ok single line: '15'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
1 alpha
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
3 alpha beta gamma
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
2 alpha beta
output:
1
result:
ok single line: '1'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
20 ccbccaabaa aaccbbbbab bcbcbccabc bbbabcbbcc ccaaccabca acabbbccab baacbcbccc bcbbabbbbc bccbbbbabc bacaccbcac cbbabbbaca ccaaacbaaa acbbbaccab bcaacaaacc aabbaabcbb bbbabbbbcc aabcaaabcb aabbbaaacb acacaababb abacccccbb
output:
8
result:
ok single line: '8'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
20 acccccbcbb bccbccaaac aabbcbbccb ababcabccb abcaabbcab ccabbabcca bbccaaacbc bbabacbccc babacbaacc bcabaacbac acbabaabbb caaccbacaa bccccbcbcc abbbbbbcbb bbcbaabaac abccaabccb cacacaccca bcbbcbcacc bcccaabcbc cabaaaccca
output:
9
result:
ok single line: '9'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
20 bcbbbababc baccababbc bcccbaacbc ccccacbaca aaaaccabbb cbbbacbaaa aaabbaabcb aacccbbacb bcbccbcacc caabacbcba bcbcbbcbbc cacccabcaa abbababacb aacaabbccb abbcacaccb caaccaacca bcbacacaac baccbcccbc abbcaccabb acbacccccb
output:
13
result:
ok single line: '13'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
20 babccbbbbc accacaabcb acacabaabb bacbccacac cacacaacaa cacaaaaaca bccbccacac acbaccabbb ccbacaccba acbaaababb ccacabcaaa bbabbcabcc bacbccccac bcacaacacc ccabcbbbaa aaababbbab bbbbbabbac abbcaabbbb bababbabac aaabcbbacb
output:
12
result:
ok single line: '12'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
20 aacbaacccb cbcbcacaaa cacbacbaca aabacccacb bbbcbacbcc cababcacaa bbcaaacbbc ccccacaaca cabcbcccaa bbcbccabbc ccababccca aaacbaabbb baacabacbc accbbcbbab cccbccabba cbccaaaaca cbcabaccca caaacbccca acaaabccab bbbaaabbac
output:
10
result:
ok single line: '10'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
20 aaacaacbcb cccccccaca abbabbcacb accaacbabb bacbaccbac cbcbbcccba bacbcabcac abaabcabab acaaacaaab bacbbaccac baababbbbc caaaaabaca abacaccacb abbbcbccbb cbcbcbbcaa cabbcaabba cbccbaccaa ccbbcabbaa ababababcb abcbcbcabb
output:
9
result:
ok single line: '9'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
20 bcaccbabbc caaaaccaca acbaacabab aaabbabbcb ccccaccaca bcacbaacbc cbccacabca ccbabbaaaa ababcbaaab caabacabca bbbcaabcac cccccababa aabbabcccb abaaaccbbb bcabaabbcc bcbbbaacac acaacbbccb bacabbabcc bbcbccbbac aacbabccbb
output:
7
result:
ok single line: '7'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
20 cbacccbaba caccbccaba abcaccacab cbcccabaca acccbccacb bccacbbabc bbacabacac abbcccbbab acaaaabbcb cbbbaabaca babbbccacc bbabccbcbc cabaababaa caacbabcba aaaaaacccb ccaaacacaa baccaabcac aaaacbcbab baacaaaabc ccabcacaba
output:
8
result:
ok single line: '8'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
20 bbaccaccbc cabcccabba bcabbbbaac caaacccaca cabccbabaa abccaaacab ababbccabb acccaaabab bababbcacc acabbacacb accccbcaab cabaaccbca cccacbbcca acabbaccab baacccacbc bacacabbcc aabaaaacab cbbabcccba aaaacbaccb cccbaaaaca
output:
12
result:
ok single line: '12'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
20 aabacacacb abaccaccbb acaccccbcb cbacbcccca cccccabbaa bbbcbabccc cabbccccba babcbcabac baccbaacbc ccbbccbbba aacaabbbab bccaccacac abbcacaccb cbcaabacba babbcbaacc ccabbbbbaa cbcbbbaaba bcaabcbaac bcbbbcbbbc babccbbbac
output:
13
result:
ok single line: '13'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
17 hydrogen nitrogen helium neon magnesium niobium molybdenum newdymnium holmium hafnium neptunium mendelevium nobelium hassium meitnerium nihonium moscovium
output:
6
result:
ok single line: '6'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
10 cbabbbcabb bacbacbcba bcacacacba bbabbbbbac acaccccbac bbbbababca bacabccaac aacbcaabcb bacbabaaaa acabcabccb
output:
3
result:
ok single line: '3'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
100 ccbcaccbab bbcbcbbbca acbbbbbcbb bacabcbcba aaaabcbaac babaaabbba bbbabbbabc bccaaacbac acacaccbaa acbacbcaac baccabcccb bbabcccbca acbabaaaac bcbbcabacc ccbbacbcbc aaaabcbcaa aacbbbaaaa bbabbcacac baabacbbcc abaccbabab abcbbabacb cbbbaccbcb bbabbcabca bcbaacacaa aabccaacca bcabaaacca acbcbacbbc...
output:
32
result:
ok single line: '32'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1000 pfalakkgegzhogw wkkuxghywruwxfe wyejymxprfudmww pzfhykyprexdzjp euglzawfswzsicw wukfsntcitmqqsp ptedktsjhdybegp woiewjinnixhftw pwysrvatyqcgxcp pyslupqwmpqluzw ezwtyuflrtgjdle pyecuqzysscnqvp pualunhhvihcohe eemgrxaolvkxmup egvaujnrfthojvw ekfhcvufcqcrhcw ecqzrgboomfjcve whxlumclfpgcanw pfoxyrw...
output:
225
result:
ok single line: '225'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
30 rfiuianksyzpkqz zkntbrwccnjcnzh hvyhatniqoeptvh zzwxgtvocagvdlz hkvtotqsilzpexr rmqjlxhiyuvtwrh ziynrswzgzpnfnz rntoducfmkqpaoz rgzweicxeqajpzr zjznfxgpfgshkbr rmtmhwrzkenopsz hyodaehasivoabz hkgxlvuxonzlvgr hcjelcmekbohgxr zkdlkppyvchvimh rehlcscmhbnjexr rhhhexryikreroz htuwcazhktbrvqr hvnicynkr...
output:
11
result:
ok single line: '11'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
300 bzpjihkgvkrwzav bssiintigbaccyv asuzprjzymuwkfv blajmgohbmihtwb bwocwcqekqwuwab azkbjbrjdnwgzhb aqdgacdlcofzjzb vvqgvpdtsphhqbb vafommzgswakrub bizlmhzwvokxezb btwrjkdkxiaciaa bgyfvakbcgcaima vtkthaktjltsvtv vmyxovrkpphmnna bgwhfiinpdjigza vaghbpbabwfsnub atztqndgqetgbzv agtepkzcnnrlfzb ayktyzbv...
output:
196
result:
ok single line: '196'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1000 drucrd dwbdnwzffwd dkcoffhuvxgzd dtd dbud dhdjamctkfkufpd dpolagked dqpyleydrcbjd diunguld dbpxmzd dd dllmgjsd dnncoucapnojd dbydsqd did dgjd dmd dkzkjmdkd derbbcjvtgxbgd dbpznlrtud dxrdhad dqhyxdd dgqd dawzjid domzfuycd dlyed dkunoduhamd dlpwoaqgjuwazd dcd dxnvgrvxnd drxptrhxd duqwvybjgahd djh...
output:
0
result:
ok single line: '0'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
18 aab bac caa abb bbc cba acb bcc cca adb bdc cda aeb bec cea afb bfc cfa
output:
0
result:
ok single line: '0'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1000 qqaligwjiggjcq iagxuiizhglmi xuikcxsrirevfi qgcyddrpx iriauckx xaq iczi xqhfnkhgx ihjmwpzmaplimcq qxhadplhx qylxcygq xi xansoq injixpfhfasvbq qiwgbci xjgmxhtxvdq iihmigcihi iedrdwzgq iyi xhqlttzyni qcx irbnlx qmcxdihujwlai iqaq qyhquti qcqzoifzglwxzdq ikjajeafi ifgydi xembxgcluzqq qyesjwiix qkx...
output:
242
result:
ok single line: '242'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
100 yhothsuntodvjbp yovbflgbufdystp plxhiphtvtvccxn yteszfwnocvquep yimksvuvxrmquyn yzxolkjfnwdwcop yvnzximnjfteqap padrxvamipryowy pxgkjkpddfbrarn ykqtkdxxwzknrvp pxewmovejzktyzn pnnjanibbinhwzn ylzdwvrozhyyyen yfyfqvvuycfaxpp nechefkhfvumkry yvtzpokomrtusyn pwpbgmtkpcnhmtn niyymfgohdgdhuy yedcxgnr...
output:
67
result:
ok single line: '67'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
1000 yaswiedrkfymnzk kzcaleacmpuazhv kfefxdppxusoqxv vifosydgwnqpssk ymtrrddmufmncfv vrupdvcsmepqtwk vjuvfllbidvbcqy veldskdioyyzock kdmjepctwkiixrv ypicbokwooycocv ybbsmccvqynbvwk yzgsbzbhteyajfk yyynqadclcjkcvv kmwrrremazrcdyv yfuauavqsoxnknv yizrfjukexccyvk yuodugxjnuymgwv vvdbmcmdcejdjhk vsesegg...
output:
360
result:
ok single line: '360'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
30 nduqkltyrjchrir npqnyjhvtczrxhk rvkhqwigvnjasln nqxnnyxpmhbzhrr kcrjplhrdkyyvpn nuxuodpvfvyovsk nzcbwoxvmuajnuk rcrqzqtykuzgiek rvzjffzzwapzvck rgntauijiodjcwn nqntaykdmrpiojr kmbynsfeerniqpr rszawhpanrairqk nhjsfdswnnaqumr kijysjjlrbwigin njebshbbcadcbwk ncwluvybyxhbuvr rlxuzfjuxgziehk rcbtttxlq...
output:
11
result:
ok single line: '11'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
300 ldqparrlixcrfhn lslzwfkysvvvaqt lklydecymfdsymn nxxolcshfdiofxt lkwqujbckqmigin nfqvomhsapqexsl njnqzhjetlnecwt twgomlfjreikycl lujnrxtaognjjbn lciyasqkkkcgrln ncwhdddgamnbgft naprkvnqkxqjdjl ttltucizicrybgl trdnzylpxeujmql nmyusbfdjyaoaft lsdwoewrtnrxhkn nfapnyvwftbnwyl lvahwwkijbffrxn tzmuasjd...
output:
107
result:
ok single line: '107'