QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#571249 | #6618. Encoded Strings II | lmf_up | TL | 1122ms | 7540kb | C++20 | 3.6kb | 2024-09-17 21:26:11 | 2024-09-17 21:26:11 |
Judging History
answer
#include<bits/stdc++.h>
#define lmf_up signed main()
#define lmf_up_up std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
const int TIAO = 1;
//const int mod = 998244353;
const int maxn = 3e5 + 10;
//#define int long long
inline void read(int &x)
{
x = 0;
char ch = getchar();
while (ch > '9' || ch < '0')ch = getchar();
while (ch >= '0' && ch <= '9')
x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
}
const int INF = 1e9;
void solve()
{
int n;
std::cin >> n;
std::string s;
std::cin >> s;
int m = 0;
{
std::vector<int> vis(20);
for (int i = 0; i < n; i++)
vis[s[i] - 'a']++;
for (int i = 0; i < 20; i++)
{
if (vis[i])
{
vis[i] = m + 'a';
m++;
}
}
for (int i = 0; i < n; i++)
s[i] = vis[s[i] - 'a'];
}
s = " " + s;
std::vector<int> ans(m);
int len = 1 << m;
std::vector<int> vv(len, n + 1);
std::vector<int> lst(len, 0);
{
int res = 0;
for (int i = n; i >= 1; i--)
{
int v = s[i] - 'a';
res |= 1 << v;
lst[res] = std::max(lst[res], i);
}
for (int i = 0; i < len; i++)
{
for (int j = (i - 1) & i; j; j = (j - 1) & i)
{
lst[j] = std::max(lst[j], lst[i]);
}
}
lst[0] = n + 1;
}
std::vector<int> q;
std::vector<std::vector<int>> sum(n + 2, std::vector<int>(m));
std::vector<std::vector<int>> pre(n + 2, std::vector<int>(m));
for (int i = 1; i <= n; i++)
{
sum[i] = sum[i - 1];
sum[i][s[i] - 'a']++;
}
sum[n+1]=sum[n];
for (int i = 1; i <= n ; i++)
{
pre[i] = pre[i - 1];
pre[i][s[i] - 'a'] = i;
}
pre[n+1]=pre[n];
q.push_back(0);
vv[0] = 1;
const int all = len - 1;
int ans_cnt = 0;
while (!q.empty())
{
std::vector<int> nq;
std::vector<std::array<int, 3>> qq;
for (auto x: q)
{
int l = vv[x];
for (int i = 0; i < m; i++)
{
if ((x >> i) & 1)continue;
int y = x | (1 << i);
int z = all ^ y;
int loc = lst[z];
if (loc < l)
continue;
int r = pre[loc][i];
if (r < l)
continue;
qq.push_back({sum[r][i] - (l ? sum[l - 1][i] : 0), r + 1, y});
}
}
std::sort(qq.begin(), qq.end(), std::greater());
for (int i = 0; i < qq.size(); i++)
{
if (qq[i][0] == qq[0][0])
{
vv[qq[i][2]] = std::min(vv[qq[i][2]], qq[i][1]);
nq.push_back(qq[i][2]);
}
else break;
}
ans[ans_cnt] = qq[0][0];
ans_cnt++;
if (ans_cnt == m)break;
if(nq.empty())break;
std::sort(nq.begin(), nq.end());
nq.erase(std::unique(nq.begin(), nq.end()), nq.end());
q = nq;
}
for (int i = 0; i < m; i++)
{
for (int j = 0; j < ans[i]; j++)
std::cout << (char) ('a' +m- i-1);
}
}
lmf_up
{
lmf_up_up
// if(TIAO)
// freopen("P4180_12.in","r",stdin);
// std::cout << std::fixed << std::setprecision(4);
int T = 1;
for (int i = 1; i <= T; i++)
{
solve();
}
}
/*
4
1 3 1 7
8
3 3 8 4 5 3 8 5
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
input:
4 aacc
output:
bbaa
result:
ok single line: 'bbaa'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
4 acac
output:
bba
result:
ok single line: 'bba'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
1 t
output:
a
result:
ok single line: 'a'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
12 bcabcabcbcbb
output:
ccbbaa
result:
ok single line: 'ccbbaa'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
1000 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
result:
ok single line: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3980kb
input:
1000 ggkkkggggggkgggkgkgkkkkkggkkkgggkgkgggkkgkkgkgkgkgkgggkgkkkkgkgkkgkggkgggkgggkgkkgggggkkgkgkkkkgkkkkkkgkkggkkkkggkkkgkgggkggkkgkkgkgggkkggggkkggggkggkkggkgkgkgkkkgkkgkgkkgkkgkgkggkgggkgkkkgkkkgkkggkkggkkgkgkgkkkkkgkkggkgggkkkkgggkggkgggkkkgkkkkggggkkggkkkkgkkggkkkkkkgkgggkkkkkgggggggkgggkkkggkg...
output:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
result:
ok single line: 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...bbbbbbbbbbbbbbbbbbbbbbbbbbbbbaa'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
1000 edbbbbedddbeebedeedbddebddddbedbbdddeddeeddeebdedbbbdedddeeddbdddbbebbbdbeddbbbbbdeedebdddbbbebebbbdebebbeebbeeddddebdbdedbedddeebedebbddbededbdeebbbbbdbebddbebdbddebbddddbdeebbbddddbedddbedbeebdeeebdedbdededdbdebbedbbbeedbbedebddebbeebddebbebbdebeebddbdeddbdebdebebbdbebdddedbbdbedbbdbebbbddddd...
output:
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...
result:
ok single line: 'cccccccccccccccccccccccccccccc...ccccccccccccccccccccccccccbbbaa'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3992kb
input:
1000 hhqjhgqqjhqhqhgggqhgqghhjjgjjqqqhhjhhjqqjqqjqqhghghjhqhghhqhgjgjhqhjjjqjqgjgjgqhqqgjgqghgqjjhqjjgqghjqjhqjhghhghgqjqjhggjjhhjjqhqgqhjjhqqjqjghjjhjhqghqggjqjqjghjqhqjqgjqqjjqjjhjjqghqjjhhjhghhjggqqjjqgjqgqjhqhjqhjqqgjqhghghhjqqhhhjhjjgjjgjqgjqqqggjggqhqgjhqhqqgggqqhqqqjhqgjghhhqgghqqjgjhjqjhhqgh...
output:
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddccbbbaaa
result:
ok single line: 'dddddddddddddddddddddddddddddd...dddddddddddddddddddddddccbbbaaa'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
1000 cceooojojcecesjojsssesjojccoecceoojecsscojsosoccojscjcjssococjscssosecooeejoosojeecjceoeeojcocosjcecocoesjceejjecssjejccjsjosjsjcjesjojcojocjjeooeccojjosjcjjcjoecseecsjccojcoessecejcocosecsojeoceejeccejeoosssscecjcssooojoseeccosocoeejjecsjeoecejsoojessoescecjjsscecoccjsjsscccssjoeejsscoesecssco...
output:
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeddccbaaa
result:
ok single line: 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeee...eeeeeeeeeeeeeeeeeeeeeeeddccbaaa'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
1000 mmmfqfmpqrccmqfcrprpfppcpcffqcrcrcqmmmqmrfmrpqffppcmqpqqrfqqcffpmqqfmcmpmcfcqcffqmrmqrmmqmffpqqpfqrcppmmpmrqffmfcfffqmrprfcpfqffrrrmcqmpfmpfmprmcrrqqrmcrcmpcffmpfcprmcpmcfmpcfprrqrpcqccpcmmqcqqfmrcrrqrqcmcpqcrcqcrrpmpmfccqcffrrfmpfqqmqcpmfpmqpcmqpmfqpffmqpcrmcmqrqfqqcrfffcfqprcprrmfppfpqqmmrcmc...
output:
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeeeeddcbaa
result:
ok single line: 'ffffffffffffffffffffffffffffff...fffffffffffffffffffffeeeeddcbaa'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
1000 hljikoiljhkhhikjihlhokhjnjlijjhkhinohnioklilhonihliiiohllkniiokjiihkokkkhnijkkkijnnjljoihiljlnjhllnjlhojnjojnnjhllilnnoloiijioiohkononkijhniihjiinononokjjokljjkinonhkojknohijhlilhjjlhkhjoonojlknjnljniklohinhinnnkhnkljjknkjhhlhlkllihhihnlkjklhokkihlhlikjhkjokhkniooljkojjiiljjjnojkiojnkniljnkoljn...
output:
ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggfeedccccbaa
result:
ok single line: 'gggggggggggggggggggggggggggggg...ggggggggggggggggggggfeedccccbaa'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
1000 cbpfmafbflfblamcccmcbbfqqfpbaaqfpccqqbqfcabmlbbmfqcpfqmcpqcfffacqbpbllappmbmcfpqqfqlcbcaclbbfqmqfqlammbcqblbccqcpabapcbbfcmpfcmmcpccbcbcfblfclmflpfaqppqbfppfpacmfqqafcmlmbqcbbfqaqffpafcbcqfpqmpcabfmcqcqpblfccmffplcbbaamcallbblmbcmammaablfmbfqqlcqacpqfaqpfcbamamcqcmqqffqfcbcffmabcfplabbmfqcampqc...
output:
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhgggfedcba
result:
ok single line: 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh...hhhhhhhhhhhhhhhhhhhhhhgggfedcba'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
1000 oikrbsjdjjsrcdbroobidjojkdjikbirccicdiicbskkciijkssjirjokcjosbbkcdkbrdroirsooiibsjokircbkjbrbkoobkrddcbossoskosbiksodsjkkocoricjkdscdickjdisiddbsdiikdisdcjdkddscdjjrkkddjbbbdidkidddijbibdisbicjokodrcbjkkcrokiciijssjjbscrssccckdjdirbbcocjkobrijssijjcjrcskdobrjcscbocoobdocobrorosiidoscrijjorsrirk...
output:
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiihgfeedcba
result:
ok single line: 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiii...iiiiiiiiiiiiiiiiiiiiiihgfeedcba'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3952kb
input:
1000 cmctnhnrhchdnnaitttiirathamrkhtahnmrttkrhdimhatrttatrtmkiminahadihkdkrdthrkrhiandtmhtrdtiinicrmmirinnarkanadnhaatkkakarirnahrtcndarniihkdnddkhitkmdrtarhinirccaitdccnncnmnanhmtrdthkrmakdkktnimictdanrcmrhtcakmcmnahcrahkhtmadmhkrriinakkrhhddmnaknacchtacaktdnmaihnhcmtcchrdmihritatkactmmhattcrkknnkr...
output:
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjiiihhhhgggfeeedccbaa
result:
ok single line: 'jjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...jjjjjjjjjjjiiihhhhgggfeeedccbaa'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
1000 bcqeheddhchrddimchmikdfsmimikchdmmbreskiqfbikcdfhhmfbmqrmsibihciqqqsefmebmrbmcedhmdkmiqbdhsmkcqkifmiddhfieqersmksfiidqesisffhhrsbkiddbkbksrchchccifqkciidibqssihmmfrmfbeffhhqdbhmmdsisqkhqmhsmhckbccfreihdreiqqfcdsfffdbhsicbqfirhhchemfihedrbbkekhsfcccfmmieqfrrimsfddbqmkemciqfqrfbsresbhsiceffebfkfd...
output:
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllkkkkkkjjihgggfedcba
result:
ok single line: 'llllllllllllllllllllllllllllll...llllllllllllkkkkkkjjihgggfedcba'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3816kb
input:
1000 pdipkeekpamgdiiafeigfaaoktngfpmkggmkdmaicekcoggpattofngagapfaifodftdmkfoctpdkkomkttgpotdggeeonkdieocdcdnffiittompaopieonamnpiigienpenieaigfiieaeiiftmpkaaegopdeamatngamagapfnppkgciptpnmpcmiagfdoaiemftddddenikaiidmmdopfapgnmefdidgdkegofmeofnetktinipopkfdpkikcodtkapngefetkaffgppkkieikmfadottcceipk...
output:
mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmlllkjjjjiiihggfedcba
result:
ok single line: 'mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm...mmmmmmmmmmmlllkjjjjiiihggfedcba'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3940kb
input:
1000 redfdnprmcbbhfdlmepnolpfotdhlrrlbedeccnrdblprfbdptohmbldthoorcrnceelhochsrppfbotmlchhsftlemfhbcnpdltofescnhmdhombpcddpscfhnmrnordbehnpdlrbbbfcdsoohpbhtcpsrhffobpehhdtmfcmmsbnpcedtmpfcpfporehfbfbotcpbeobnlednofedbpldcrosfcfnplnhbdlohfedrpsosmrpedenpfrrnsbehslloeldemsoeenfrsssppldtnfelrlboepptlpo...
output:
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnmmllkkjjihhhhgfeeeeddcba
result:
ok single line: 'nnnnnnnnnnnnnnnnnnnnnnnnnnnnnn...nnnnnnnmmllkkjjihhhhgfeeeeddcba'
Test #18:
score: 0
Accepted
time: 14ms
memory: 3776kb
input:
1000 hegsdmeapjipglsnfmianparlaersaragrlepapooflllgnsiggjdjdpraslojdfdaaesfpllhnihselidejrgrfmmaldfnrejophlanehrdsjrrsidomemhmeafrgrrajrrfrjjgpfmgsprifnolfglhmnfapljamsldgrfsomopfedsegdadmojparrssjpfsfaporljfhsfhhgrnilmhdlppoldhaomrjprnfirlmnnhfseofjenrohflfndfiimmsirjopeeipafhphogsafrngjjiprnifeila...
output:
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonnmllkjjiihhggfedcbbbba
result:
ok single line: 'oooooooooooooooooooooooooooooo...oooooooonnmllkjjiihhggfedcbbbba'
Test #19:
score: 0
Accepted
time: 41ms
memory: 3920kb
input:
1000 dgenmltemgsnbimnhicfomcbbliddfhllohldnthotglfeoobtohilblglibclhdlmmfgseslgseiimkhhbflfekildtgllfdkjolnilbtscnfjklfidbknhlljkokodbtmoccbiigicgnfdfbhktcomilkbijisdhmjcmgbkomojjfmdnjltbmnnsbslbtflkkbsofehhnndmjtifsisggeocdbtolimtnlhcoekedjsnhoobbjnhihbbtkomnjomiskfobilkjkbocdmhnffglfogtosndsitecdf...
output:
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppoooonnnmmllkkjjihhgfedcbbbaa
result:
ok single line: 'pppppppppppppppppppppppppppppp...pppoooonnnmmllkkjjihhgfedcbbbaa'
Test #20:
score: 0
Accepted
time: 124ms
memory: 4400kb
input:
1000 chkkcqdcggjsjadhtrjqgntecdhgrsqsbkqqqsodfkfcblqntsjrjnfcteghkafgjqtaaabdddakcbnabaqtoqdkogfgqaebrsdcdqkadkeqoleknokgfhshkqdhhsjddatblonnlnkllordrbgjjsjdedhlgsdsodcbcbojaehanhqetgnasocghtcrdbqdclegfscnqcelofffckefedohhadlhhnadnffbkreeletoknrrhrffrogrcgghaeglcefhbaaefggaabohttrstfgfqgcnnbeqjdklqr...
output:
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpppooonnmmlkjiihgffedcba
result:
ok single line: 'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq...qqqqqqqpppooonnmmlkjiihgffedcba'
Test #21:
score: 0
Accepted
time: 371ms
memory: 5504kb
input:
1000 mmimrctldielpadeocgmaifcafkhjccnaktgmsejehgcoialclsopnrokmamnahangmhfmgcrmlatislecsgiaaarkpssscshtcrncptsoijirnogggititpohtgcaegdaaeoegmioridoggttsorppehjhiondejafeanspotcngepscflcseeikasopdmdthgnasdnfedkookrnkjcsinkejkiskasoecnlnkigrdfktopfcoehlsednknimtshljrdlnnainrfskmddegerildgcnkmfoapefalm...
output:
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrqqqqqqponnmmlkjihgfedcba
result:
ok single line: 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr...rrrrrrrqqqqqqponnmmlkjihgfedcba'
Test #22:
score: 0
Accepted
time: 1122ms
memory: 7540kb
input:
1000 qdjplrlfkgqbnncnglcfdijiifboesenqmfjilnqrppabmntsgdefcjrkotiejacrdmqqoegtspofdejngqmddjatlfakscdcfdfjfrqkfllmoteldgnirkmpmbjfpkkiblsnjsqjijposifejtoliolrfionfiirqrdojcfqipraenpfeqfqcegkfctssmrrbdjkkrbctqiqejsfsqcgdnoaelcfaslegtrcefleqqjbtgjpbjrdqtmajcfgotetrkeeoqptnsbkgoaedsqorniralmeklcigocfal...
output:
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssrrqqqqqqppoonnmlllkkjihgfedcba
result:
ok single line: 'ssssssssssssssssssssssssssssss...srrqqqqqqppoonnmlllkkjihgfedcba'
Test #23:
score: -100
Time Limit Exceeded
input:
1000 opaqmbjhoctlnmefoocaqnqtecgbnirdjjhqkhiftktbslrpbacpjbrbreapkptlrcpjqpfobtiiqqtjpsrpitbljanmfdfbhldlplsniffflegrtckqjdarlhleffsalnjgmfrpasfgatgfffraheohidlolipksnskjjfaihidesjnlasitccjbbhpheglpdertnqqlgsfafikpneglbokpfaejipaeolmdrinnafpntfichatljgiqlaqhfmsmggdohcncpihiinqbssjnaleiripnbgllhcnnha...