QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#477374#9126. Number of Abbreviationsucup-team3099#AC ✓2ms4008kbC++203.9kb2024-07-14 02:32:202024-07-14 02:32:21

Judging History

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

  • [2024-07-14 02:32:21]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:4008kb
  • [2024-07-14 02:32:20]
  • 提交

answer

#ifdef LOCAL
#define _GLIBCXX_DEBUG 1
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

#if 0
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
 
    template<class T>
    using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag,
        __gnu_pbds::tree_order_statistics_node_update>;
#endif

#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <queue>
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <ctime> 
#include <cstring>
#include <random>
#include <chrono>
#include <cassert>

using namespace std;
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)

#define each(a,x) for (auto& a: x)
#define tcT template<class T
#define tcTU tcT, class U
#define tcTUU tcT, class ...U
template<class T> using V = vector<T>; 
template<class T, size_t SZ> using AR = array<T,SZ>;

typedef string str;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
 
template<typename T, typename U> T &ctmax(T &x, const U &y){ return x = max<T>(x, y); }
template<typename T, typename U> T &ctmin(T &x, const U &y){ return x = min<T>(x, y); }
 
mt19937 rng((unsigned)chrono::steady_clock::now().time_since_epoch().count());
 
#define ts to_string
str ts(char c) { return str(1,c); }
str ts(bool b) { return b ? "true" : "false"; }
str ts(const char* s) { return (str)s; }
str ts(str s) { return s; }
str ts(vector<bool> v) { str res = "{"; F0R(i,sz(v)) res += char('0'+v[i]);	res += "}"; return res; }
template<size_t SZ> str ts(bitset<SZ> b) { str res = ""; F0R(i,SZ) res += char('0'+b[i]); return res; }
template<class A, class B> str ts(pair<A,B> p);
template<class T> str ts(T v) { bool fst = 1; str res = "{"; for (const auto& x: v) {if (!fst) res += ", ";	fst = 0; res += ts(x);}	res += "}"; return res;}
template<class A, class B> str ts(pair<A,B> p) {return "("+ts(p.first)+", "+ts(p.second)+")"; }
 
template<class A> void pr(A x) { cout << ts(x); }
template<class H, class... T> void pr(const H& h, const T&... t) { pr(h); pr(t...); }
void ps() { pr("\n"); }
template<class H, class... T> void ps(const H& h, const T&... t) { pr(h); if (sizeof...(t)) pr(" "); ps(t...); }
 
void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {cerr << ts(h); if (sizeof...(t)) cerr << ", ";	DBG(t...); }

tcTU> void re(pair<T,U>& p);
tcT> void re(V<T>& v);
tcT, size_t SZ> void re(AR<T,SZ>& a);

tcT> void re(T& x) { cin >> x; }
void re(double& d) { str t; re(t); d = stod(t); }
void re(long double& d) { str t; re(t); d = stold(t); }
tcTUU> void re(T& t, U&... u) { re(t); re(u...); }

tcTU> void re(pair<T,U>& p) { re(p.first,p.second); }
tcT> void re(V<T>& x) { each(a,x) re(a); }
tcT, size_t SZ> void re(AR<T,SZ>& x) { each(a,x) re(a); }
tcT> void rv(int n, V<T>& x) { x.rsz(n); re(x); }

constexpr bool multitest() {return 0;}
void solve();
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int t = 1;
	if (multitest()) cin >> t;
	for (; t; t--) solve();
}






















int cnt[128];

void solve() {
	int n; re(n);
	string s; re(s);
	
	ll tot = n * 1ll * (n+1) / 2;

	for (int i = 0; i < n; i++) cnt[s[i]]++;
	for (int i = 'a'; i <= 'z'; i++) {
		tot -= cnt[i] * 1ll * (cnt[i]-1) / 2;
	}

	ps(tot);
}


















































	







这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
abbab

output:

11

result:

ok "11"

Test #2:

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

input:

5
aaaaa

output:

5

result:

ok "5"

Test #3:

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

input:

4
utpc

output:

10

result:

ok "10"

Test #4:

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

input:

2
aa

output:

2

result:

ok "2"

Test #5:

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

input:

3
bab

output:

5

result:

ok "5"

Test #6:

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

input:

4
accc

output:

7

result:

ok "7"

Test #7:

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

input:

2
cd

output:

3

result:

ok "3"

Test #8:

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

input:

10
aaaaaaaaaa

output:

10

result:

ok "10"

Test #9:

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

input:

5
bbbbb

output:

5

result:

ok "5"

Test #10:

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

input:

3
abb

output:

5

result:

ok "5"

Test #11:

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

input:

6
bcbddc

output:

18

result:

ok "18"

Test #12:

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

input:

1
a

output:

1

result:

ok "1"

Test #13:

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

input:

8
accbabaa

output:

28

result:

ok "28"

Test #14:

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

input:

9
ccacdaabc

output:

36

result:

ok "36"

Test #15:

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

input:

6
scguem

output:

21

result:

ok "21"

Test #16:

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

input:

8
czqxyciv

output:

35

result:

ok "35"

Test #17:

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

input:

3
nky

output:

6

result:

ok "6"

Test #18:

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

input:

2
xn

output:

3

result:

ok "3"

Test #19:

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

input:

9
muduhznoa

output:

44

result:

ok "44"

Test #20:

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

input:

3208
udhavrncwfwujpcmiggjmcmkkbnjfeodxkgjgwxtrxingiqquhuwqhdswxxrxuzzfhkplwunfagppcoildagktgdarveusjuqfistulgbglwmfgzrnyxryetwzhlnfewczmnoozlqatugmdjwgzcfabbkoxyjxkatjmpprswkdkobdagwdwxsufeesrvncbszcepigpbzuzoootorzfskcwbqorvwdrmklfdczatfarqdkelalxzxillkfdvpfpxabqlngdscrentzamztvvcvrtcmbqlizijdwtuyf...

output:

4948950

result:

ok "4948950"

Test #21:

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

input:

4788
iqurwrbrbxmhbrdpdrerbobajuldlwrpkrtfblspnkxyitiohlpgjlcktlaqsalnoiphbtuyrrghseznkmzukaiihatzttiylactadtninwcsufbynjkxaajnagfevscfuhoajuqmisgbbsxqbylmraszacpliuglqyuzbnizxxjxnntsckjzjzjmmyfmvxjaopvefhwhbyoapkqedyddtrpblporursknpbtamzkkzrrddcmrayglnjuikqynjaucaqekhcwxdqpdohycvaexjyulgvwtovqgsfivk...

output:

11024172

result:

ok "11024172"

Test #22:

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

input:

3429
rkwppxiscaykvmkyjkjjgzidbatjujgdcsoqnlxgxxdeyewhvtncvpusjinbrrjcwfxcafbxpytbeypcoswmpdcbdcmjsfzyoohdzyudjoukiowfcmhpliccyhiigrnjmxyafnxnfzvnbnsxbkampswfmooflqwwdnsajuzisgrzozdgnhhuaibgyctpyqhcxchhygihqaermspsgomqkyltmrfgqbdhiloyxfityhewgmvcakcxunuxogdvurumqogwljlfhysyjvvefpkbyibzeqfjhzymhdkdzue...

output:

5654827

result:

ok "5654827"

Test #23:

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

input:

3534
kdqyaoiwlwmjakzvhicdmyhcxgeryppfgvhepimgrqolqyibjphsjkmdkaqbkywtbqehrmybevnqutdlyqpogemuudzxbhjlbgvdnzunubuepbcsjbpcydehbrgjppiqebgxhdtqxwizichytscewaoudjzevuodgdgqfdzvrboxopvfdboyskolrvdfoirkqpiwowgypybchbmwtbeaolsrxqcoxwntbyimajfpauymwjwibotkziuttjqcnhudhylqbxrbxkvmudthutqqenfncshtaqswmqucjvu...

output:

6006844

result:

ok "6006844"

Test #24:

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

input:

4595
hwngzhxrirwhhczpnxmwqrochdzfiwzqxaimcojsrvdxxfkkhyognkrjxbljmbsbzbdrhczlvpoyeqaywlpyxaflehnvhykqtfnzcopcqremmbntrqdmtiwqtcphenxfninboegxjgopifnpbdxcrvjldzavdpaedmyqooklctyzfpqnxiqfcyaoouxvripjxpmwurmhnidhtqdbnjxbtrdqisxyxmnpoqykvodnvuhkpvgzkqfhyaqjwfzhbozkocbyomkzchqlcnnzdqakmytfmntdgojcgnejhpm...

output:

10152436

result:

ok "10152436"

Test #25:

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

input:

259403
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

259403

result:

ok "259403"

Test #26:

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

input:

451784
aabbabaaaaaaabaabbbaaabbaabbaabbbaabaaabbbaaabbbbaababaabbbbbbaabbbabaabbaabbbbaabbabbaabaabbababbaabbbaabbaaabaaaaababbabbabbbbababaababbbbbaaabaaaabaaabababababaaabbbbaabbbbabbbabbbabbbabababaaabaaaabbbbbaaabbabaabaabaaaababaababababaaaabbbaabbababbbbbbbbbaabbabbbbbbaaaaabaaaabababaaabbbaba...

output:

51027640724

result:

ok "51027640724"

Test #27:

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

input:

383147
cbacabaaccbcaaacbacabbcaccbcacbccbccbcabaacbcbcccabbcccaabcbcacbacaabcbbccccacbbaabaacabbbbbccbcabaaacacabcaabbaacbbcbbbcacaccabbaabaccbccaaabbbbccbcbaaccacbcabbbbbbcbcbabbcbcbabbccbabacbccbabaaaccabacbaccbbacacbcbbbcbaccbabcbaccacaabbcaabacabccccaabbacacaacccbabaccaccacbababbbacbbabbabcbabba...

output:

48934195363

result:

ok "48934195363"

Test #28:

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

input:

298623
ddbaddcacdacdacccadbdbacdbbcacccbbbddbbadbdcdbdbbaaabccddcbbadcbadacabacbcabbaddbcadbcbbabaaaddcdadadabbbdaaabddacdbaaabbbabdbbadcacccabcdabbbbbdbcaccbbdbacdbbbcbadccacdbcdbdddddcbadabdbdacdabdcaaaadbbbbacdddbdcacacbacacddbadacaacccabdbdcacdcdcdcddbaccbbbcddcbdaacbcdbcbbaccbacbcdccdcbdcabbccb...

output:

33441140650

result:

ok "33441140650"

Test #29:

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

input:

358847
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

358847

result:

ok "358847"

Test #30:

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

input:

427315
aaababbbaabaabbbbaabaaabbaabababbabbbabaababaaabbbabbabbabbaaaaabaabaaabbbbabbbbbbbabbaabababbabbbaababbaababababbaabaaabaabbabaaababababaabaaaaaaabbbbbabaabbbaaababbabaaaaabbaaaabaabaaaaaabbbabbbbabaabababbababbabaaabaabbaabaabbbabbabbbbbabaaababbaabbbababbabbababababaaababaabbbaaaaaaabbaabb...

output:

45649527559

result:

ok "45649527559"

Test #31:

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

input:

338812
babbcaccccbbbaaaccbaacccbbbaabbbcababbcbccbbcaaaccabccbccbacbbaabccacbabbcccacccccabcacabaacbbaababbcacbacccabbccbccabbaabccabccbabbcacacabcbabaccaacaabbcbaccabaccbaccbcccabcbcbbaabcbbbacacaccbacabbabccabaccacbcabcccbcbbcbbccbcabcbbabbacabaabccbcabaaccbbcacabbaababcaabacaabacbcacbbcabaccccbba...

output:

38264629469

result:

ok "38264629469"

Test #32:

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

input:

292752
bddacddcaabbabaadabdbbdaabdccabbcbdbdcdcaccdcddbccdcddcadddbbddbcaddddbccddcacabadbdabcdccadabcadaaacacbaccaacacaaacbdcbdacbbcddddbdcbbdadabbbdbcacdcdadbcaaccdccabbcddbbbbcccddacbcaccdcbaaadccdbadbdaaccbacddbbaaaaadbdcbcdaacacbdbbdccdbcbadacbaccabdbcbabcbccdcabcaadcbdaacabbbaddbbcacbbbdadbcab...

output:

32139087857

result:

ok "32139087857"

Test #33:

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

input:

403030
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

403030

result:

ok "403030"

Test #34:

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

input:

272405
bbbbaabbbabaabbaaaabababaaaababbabaabababaabaaaabbbbabbaabbbaaaaababaabbabbababbabbaababaabbbabbabbbbaaaaabbaabaabbabbbbbbbaaabbbbabbbbaabaabaaaabbabaaabaaabbbaababbbaaabbabbaabababaaabbabbbbabaabbaababababbaabaababbbbababbbabbabbabbbbaaaaaabaaababababbabaabbbaaabbaabbaaaaabaaaabaabbabbaababa...

output:

18551392289

result:

ok "18551392289"

Test #35:

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

input:

339136
ccbbcbcaaabbbcbacaccaaabbaabcbbbbcaaaccabbaacbcbcabcbbbccccccbccaacbaaababbabaacaaabccbcbbbabaabccacbcaaccbbacbabcacbcaaabccacacccbcaabbcabcbccaaccababcbaaccbbccbaccccaaaacbaaabcabccaacbbcbacababccaaccccbcccbabbababbccbbbbaaabbacccbaaaacbbcccbcbabbaccabbaccbbcbccaaababbcaaabacbcbbbcacaabababb...

output:

38338032393

result:

ok "38338032393"

Test #36:

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

input:

395796
dbbbcddcaddcccadbcdcacdaabbcdbcbdcaccbbbbcccdbddbbdccccddbadacbaadcadcacabaacbabadaadbdcaadddbccbbdcdddaccddcabdadaaaaadaddccdcdacbdcaabaacdacaacbcbccdaaddadbddcdccacccccbccdaabdaaaddbdbdabddddccbccacdbbddacdcccdbcdbdbaddabccddaddabadbdadadccabbaadbadbabccdcbbddbccccadbcaddcaacacccdbbbcdcdcaa...

output:

58745698646

result:

ok "58745698646"

Test #37:

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

input:

375258
efwdkyoszitpwgtollrejclsrrgxdoyrxuuitncokifjdcbxzrewsdobvibquinpgsgwozmwvkyiosrvopxkknfhofuamizpqwwkzqdbeokhyrsmbmyozeoaxktgtqrfiefgeqctdimvgzvhxaklztkwzssvmtyjeiqvjwiyduaohchdkvodjtldavqirvywwfvczbcrqfhdxitggocaemersflsxayycdzptsrwqgrxsiclwpccqjrhfccvvozpvyrlkkmyyzdnortqcxqjrbrnwhqcrsuzovpvm...

output:

67701430251

result:

ok "67701430251"

Test #38:

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

input:

290254
wytycjjdcktibajwvlqxlkejfnoctilzdfkeafqicrzxtgjxiwtfzrbzgexnrixjwgvtdnlnzzrtxazncwpquakrsmnvvrwywlrcmtbpgmdnhpvxuaeqkotbsievctajgnrcnceqgrfdanzaqohrdjxhsrztgowluhamgusaszefowepydhrhlmkmnfdtigxbpszxraooszplheodofbbgmudcdhjsngssmnvemxmlrpsyesgngtqrhggbdptmzatxkvbxlxfxfkmjuasfhohjattnsiionsgvopx...

output:

40503673675

result:

ok "40503673675"

Test #39:

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

input:

280730
ywhbhnaybsogzcggyebgrjoffqblxlivtltvtnwbhziclszbhdppqshflmgnquayesxrskrkynhrfkerravnjegezprvtihcjgetqcutpujaakvvddchotkltkpiwdjiggcmpnhxwnkliiskmtztxpnwainstdkpxfgwmxppbhrzkwjwmlbptdpovvifshosbgbzhlqojcbcismcrocjyjrwsxyppeqgzdajmylhduxakavdqxvvqrdhmtzgriozmzyqafcszlbrfxdtpguuxqucawugijzgckyto...

output:

37889251466

result:

ok "37889251466"

Test #40:

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

input:

451887
ddhrlcvptkwsulmnxjnnxtrinnzeziqkkjzgapidtcggzglyzruvogvrdtbgyqjazasufipgefwdrnzethxalgexbdtlembpbmsvgdhpgabbtlujcksbtsshrhdgzjtberswgdfmvyicoeleawjlmrqiagxtasqcqdaevxwphojnzxazanjgwtriocydumndsaxuiahusjrzuzmzkiaxwzebtjrrzvrqvpzzobtnscjqfogxuonfdwrlamiqtmbdpvpdpkfszutodddmburpxfkobgvjfebvovnxj...

output:

98174197263

result:

ok "98174197263"

Test #41:

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

input:

382168
qawbyxfauveufgshlilzzbolreknbhehcpetrnvwkyrlbgryzbhzlmjzsndjaxzbfloemyvlnzdycxhfniczmjpwvnjgbqxujwlivdblrhccifqmfnpxqrihqnmmyuwctwcsznfmajetyzqnfagjigrumjtdkpvqutxhtlwabpdvtrtiypeaxluvmusjtiyunoujjgmnnuujdgczzsqiyjhelgkwfeeomogjiphjianidnlvdxaeclugtuorjsabdtblvpgqcirruzsirkmbfonuewqjykclisejo...

output:

70217747714

result:

ok "70217747714"

Test #42:

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

input:

500000
ababbaaabbbabbabababaababaabaabaababbaaababbabbaabbabbabaabababbbaabababbaababbbaabbaababbbaabaaababaabaabbbbabbabbbabaabbbaaaaabababbababaaabaabaaaaababaabbaabbaaaaabbbbaabbaaabbabbbabbabbbabaaaabbbbbabbbbaababbbabbbbbbbbabaaaabababaaaaaaaaaaaaaabbabaabaabaaaaabababababbbbabaabbaababaaabaaba...

output:

62500297500

result:

ok "62500297500"

Test #43:

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

input:

500000
abaccccabaababcbbbababbababcabbccbcccbacaacbabcbaabbbacbbbaccababacabcccccbbabcbcccabbbccccabbccbbbccbbccbaabbcabbaaaacbacacccbccbcbacaccacaacaacbbacbbcccbccabcbccccabaabacbabcbaacacaabccbcccbcacaacbbbbbabcbacaabcabaacccbbbccbaaabaacbbabbaccabaccacaabaccccccbcaaaabbbaaacacbaaaacacccaaaccbcbab...

output:

83333762841

result:

ok "83333762841"

Test #44:

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

input:

500000
dbdcacbdcdacabbdbacdadaabcdbbbacccbcccddaabaabdcdacdbcccdaabaccdbacddadbdcdbdbddbabacdabdadddabdbddcadcacbbdaccbbbcbdcdcdbdcbadddddcbabbacbabbdadcabbcbddabddacdbcbddcaccbabadbbccdcbbbbbbbbbbcbbcaccbbabbbdbbccbbbdbddbbdbdcccabddabddaddcdccdbadaabcdcababadaaaadcdbabacccaddacddbddbbbccacdadbcaad...

output:

93750221936

result:

ok "93750221936"

Test #45:

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

input:

500000
baababbaaaaabbbbabbababaaabababbbabbaaabaaaabaaaaaaabbbbbbabaababaabaaabaabbaababaabaaabaabaaabbaabababbabbbaababaabaaabbaabbabbbaabaaabbaaabaaabbbabaabbaababbabbbbbbbbbaabaabbbbabaababbaabbaaabaaababbbbbbbaabaaabaaabbaabaaabbabbbababbbaabaaaabbbabaaabaababababaaaababaaabaabbaaabbbbbabaaaaaba...

output:

62500468316

result:

ok "62500468316"

Test #46:

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

input:

500000
cbcaccabbaccaaacbcabababcabacccccbcbcccbacabcbbbccabacbbbbcbaaacbccababbbaacaccbccccbcaccccacccccaabcccaaabccbaabaaabcbbccabacabbacaaabbbaccbbcabbaccbcaabbbaccbabacbbcabbacacbaaacaabbccbababaccabcbbacaabcbaaacacacacabbbbccaacabcaccaccabccccbaaabaaaacbcbbcccbaccaacabbbcaccccbbcccbcbbbcbbaabaaa...

output:

83333818659

result:

ok "83333818659"

Test #47:

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

input:

500000
cabdcacdcacbaaddbbcddccaccacbcacacbbdbbbccdbccaaabbaccacaaadaaccccaaadbabbdbbdbccbaccbddcbdacabbcaacdbbbbcbdcaacddbbadaddbadbabbcddabddccbaaacdaaccacdcbccbcadabaacdaddaccadabbccdbcbbdcdccdacdadacddacadcadddaaddadcdcbdbabcdacabdbcdcdcbadbbdadcacaabddcbcdbdcaddcccdbbdadabbadabddbbaabdabadcadbad...

output:

93750097409

result:

ok "93750097409"

Test #48:

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

input:

500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

500000

result:

ok "500000"

Test #49:

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

input:

500000
aaabbbbabbabababbaaaabbababbbbbababbabbbababbababbabaaabbbabaaabbbbaabaaaaabaaabbbaabaaabaaababbbbbabbabbbbabbbaabaabbaaabaababbaababbaaabbaaaabbababaababbabaaabaabaaabbbabbbaaaaabaaababbbaaaabbabbbaaaabbaabbaaabbbbbbaabbaaaaabbaabbbbbabbbabaabaaaaabaabaaaaaababbaababaaabbabbbaaaaabbaaaaaaaab...

output:

62500470071

result:

ok "62500470071"

Test #50:

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

input:

500000
bbbbbcbccaaaacaabcbbcccbaccabcbabbcbccbabcbcbcabbaabacbaacbabcabbcbccabcaaccacaaaabcbbbbaabaabccaccbbabbccbacabbbbaaaacbccaacbaacbcacabbcbbabbcbcbcbbbbabbbbccaaababccbaccbacbaccaacbbcaaccaaacbacabbabababccbbbcacccbbcaabbabaccbcbacbabbbbcccaaaccacbbcabbbacabbcacbbcbaaaccaaabacabcabbcbccacbccbc...

output:

83333275319

result:

ok "83333275319"

Test #51:

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

input:

500000
dbdccaabcaabdacbdbbccacaaaddccbbdaaaadcdcaabccddbabddacbbaabaaabcdbdabbcdcaddbbcaadcdacdacbacbcbbdcacacdcbbacddbdbdaacbcccaabadcbcdddcdaadacddbddaacdbbaccbacdbaabcdbadbdbdabadcddacbdcbadacdbdcdbacdbdababdaddcbddcaabbabbcdbbbbdcccbabddcdbaacaaddcdcaddddadacaabdbdbcccddcadacadbbdaabdaacbdbdcbba...

output:

93750313684

result:

ok "93750313684"

Test #52:

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

input:

500000
eeutjhcedmpqmegbnduoxrbcorelebeboytxnrflffrclvoedmviwlpeiebviwijcmnocdumgmbvppwzqemhqtmtdchbamfcaluxdnrimdgihfqcuxsxmhsfcncsmoptahgsfrzqaumgprmuyfloryhcbjukduqyptxmwqouopgnfzmwmzysubhhqrqxoqaizxykbigwcwfeaoesgtybzrwtotecetxjscvmznbrhmkmvktozzlrzhuobskcowstbhjnsiofvbmllavczxrptolefmjpkzdhwudjl...

output:

120192593132

result:

ok "120192593132"

Test #53:

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

input:

500000
avkigoxkemxunlehtbkvifwrtaggfossgyuyfdhhafrmsdaoacdmstwacpvankydsiryvotrqlmxfrhjfbclpscdpspnxydsjslnmuwcinnfhuinpgsehnkactkgedsxbvugdfrgxdrbmjnaqoaylureamtirfbtngljdgicxfncogppuyltmggeigkhossgdnutryctnwfoivikrifcwewtedeqhbsngfwilcmordkjwpldanewxlkxdxwtfamnkkkhbgpxyfsfbxdylvlvrpydpfsqwnpiafpbv...

output:

120000195616

result:

ok "120000195616"

Test #54:

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

input:

500000
imlorsqbhqhlkqgphggtvsfdokeoanqdpkhurobhwejokgwnrckqnaghxiikqbkocmikahgdovusxtxqrneahgmcdhpanwobnajersbplreulctmmljgnpsqojfofqqberxobtipsdwhsxhhfhmwtinvvlhqsseqdtmndnfbnovqbphdhpcmhusesbaqijfsxcpuuevpcanjuwpfawovlqtktivmebbndkjxqvfoemtqxhdrequetantdsrhkmctchidlmpspwsqfoxtfrbnnoedwurfwrgrknisa...

output:

119791972594

result:

ok "119791972594"

Test #55:

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

input:

500000
pufftoqhuetjjggjpfdtlmeovmmfgnteadjvitdugwlnnkbhajncgosweindgddtnrdfjpnmogfddhfbfgrcppltprfouavmirjfhvlatkkjfkstvnarmhumvbhusbprojgvjiliihlhmmnjhfrnqdnkafpqlafitikanbjgcvpjfiarnldgaleqwrmlsadrmnlcopsarnksccdfacvekwjomvihdojrfwvkhsqfpcdwsdufrvjoojghvqarcngmarwspqrosmhhuvvsnkfenklfonsvocujkmlfp...

output:

119565516053

result:

ok "119565516053"

Test #56:

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

input:

500000
qdgdbtfrlejtuevdgmpbbgoltkpvickblgrsmsvdcdgpeekktsmencljmbcrcbqhblnaflmrbbavmgpppkkiihjifnfbbdmgjjckhkkhjtteislooukbcgbahoiaihhtjfothiihsjsckharsepepmbppfkflpvchnebpvgflundhvrfdaieqocgtigiljsfhrtniisngupkgpltbgrhurnearuhuaqgkvrvuhoqnuoccadlrkplgkmvpicltlaosjcqcfesilsvqttdnevhnpfhnsahhvuknbotn...

output:

119318386919

result:

ok "119318386919"

Test #57:

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

input:

500000
avfgvtaakrbqtfobadoqqfbpufurlsrxgsbokbulchdlzpwdljhglassfenzqjxpfdcfrvzhbdisuqkgpeyggkcecfkuexyyheinfsdkykcrihrmozurmcrluubnejrneznrpniuhfshtrhjlgebsydhevddovfeothlrxvngrjqtdxvyifuxawtnuwoxaavhzrokqmykcxkgasozgahrlriftjaocxevjueqswyzuxpimmmvejdtkuzgqzmxkgezccjggwnvpiererhivhgmspfedentpqcjetjz...

output:

120192626837

result:

ok "120192626837"

Test #58:

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

input:

500000
axybegoynpwozzaclgcnlggucsaptjbvkojwgfgojaapbcwpbftygnngxfuoqyanhgcoejjonhoijlfghhwuzizbgtavwxaondebdivsidfqrbupfuneoaipfudnqrbrmhmtozshnyznuqpovqjqhowsjzibdvjafckiukkenbpihzzqqtbyhqpawpuphfbxmaldprzzjcugfhaeuzaljttufkhjlhggnlmegvpimduptpzotmxinvgpydwmhemgzbesufyelcspjwjccuulslttfzujkigsmikgp...

output:

120192592784

result:

ok "120192592784"

Test #59:

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

input:

500000
npryzwpvnorcwvwraydnhhiolaoueeqrjreoqbwhmxxxydsebjdswyfgonzhvrhxkvlcwklfyednktmtbqunelaeivcuhufpsryfplxcdvrfbaaemutlcztrqumptvjgxgimyphwsmwinuebavgkqwvrecpquqofpacceqjjbmoejaqxekkzjaunaqpcdcrueyfptiaaevstokyxytegtaugqvrwmplaiablcogmscposryrgnzhzbtpklnhbtkzrpldmsydndobidizxrwzewxbpffzlwjjusrcv...

output:

120192667175

result:

ok "120192667175"

Test #60:

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

input:

500000
xfcsuzygjkboyhtgeqmrbinmawdskjkcomiaggjjlpmzqgbzeyoirbxcjwsgigniflkfqogydshfcngyxuhqlpksuytatucfemdjcxbchahaikvdmcffzrxkoksltupgojfqylutnrrujynmosiizlxisjissllyqwpisloxbpezhfkelgacsviauvhpaxuwgzdwgielcqweoethwqasjmfugdlsztonixzzzpsylmmaskmxyeagdealijbxhpfeizgtvrruabzgzdoboplasintprjioonmcjmgm...

output:

120192615911

result:

ok "120192615911"

Test #61:

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

input:

500000
bodopshojazmcgnhegtbvfofujdvykzjdlfnjmfybepkbfueoyddlssognbjoitdivpbkuriyvtqoxacfuvlowvrntpkmxvolpafphgderqyitffjxrcvlsgzdmvwcnpmxzjiwrbhxmwuuxxabasfzrbtjetfmjtreefyjmctamtagloioheexwubeokywnmekuugvxvfeplnuyuntysdqwtwurfpdwgifupaonztshpcmmikyyttmuarkwtbsilfvtuxugrpgpuhggqooxmwvulpwemzezplayay...

output:

120192572879

result:

ok "120192572879"

Test #62:

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

input:

500000
khfkjuujwpluinorjbtpaobjtwvigxlycnzbdjpcdvyboslatngiqczwfxqxxowuyesvwyhzaoisakjxzoxupsfrofaywzhvccvcxluvsigoxnbeaehoiqdzzhwrnvgvirbpckcgsyrumhqrgnyqshwuewpqtedwlrvfcmoehkviaqqsdhfhddnwfebrdjsvucmbsscluqjcbojmzymiorkabpzleqzgvoektcwuhoijzuaqxenngpvxslzkufcweegwzspacwgmiezqwldiqunlkudjubsgfwjsl...

output:

120192566486

result:

ok "120192566486"

Test #63:

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

input:

500000
dbkshpiqwgvffwfbpnfstnwpgajlmtnznklgshnzuwrqwbdeewcefxvarvkyvwjhwzlddzliggkpcbadzfloldrrpdlcwzzdasbeiqyndoioyftyhsxazwjggwiyazccaefjrctlhbpbknifeabpopqicfpnvhkxwueyykkoonkhrssqjmhmfnqkjuljkcoawsjergopczvvomnincssingedujpmzkbyizkszgurkbanivgvszdexaqtxhsgyykjujkpbedaqqmubduxyllccwfzqnciznujsvvx...

output:

120192606579

result:

ok "120192606579"

Test #64:

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

input:

500000
khcvbuokeatnzgitapmrtcoeqmzpjxlnskfgaezspqdbrsyagtvohisgdzdygqnvnpgzdzgwfprzmkifxbqtjgbhrcoondipewmaqibkdhgavhcflotgkhveqnrjlohmwjskhuvrvykjaiexglttgdocpgyyhexlrikyisjvwkqakgboludtmseicrqtffmutotasjvzftppawrswkhhhzexbvvacwddmtkxvwyxhtvhwtzbvhuzpwiwdoevjouysmmyhyahuinhhncdzqgzhbtkkvmnmgdaadebl...

output:

120192663118

result:

ok "120192663118"

Test #65:

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

input:

500000
tqrwmveljqzksrpfzqgqwemgprwjnhyvrqbyzwicyfiowztjxklhprjdcrdsrmnthpikdbchthezrswarhloihoghqppzglvmpsmbybcqeugfilvhbauhncbzvrmuqucagxkagvozbhqymmudwrkcmzryggozxsrbqnihlantezjdphdxoxebqfhmsrbibqwyponnfwjqfplosofylnqifqjtfpsyhfxxbrmsfxvkgidxqatevihjqglhvgikzxwqyieotpcwzcsfqfbhklkrimqzefbnslkewgju...

output:

120192622494

result:

ok "120192622494"

Test #66:

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

input:

500000
adbbdorprvjezlhsxlflapmzibsliotdostjalzidktyyywmyzzvmudqkudvnynhlhbnzwmxdfvzjoonpjgzedmlbswkxajltiywvixoforlyasgpgerbicdpnhiqiiczsekusjtrrbhvlvvmsvbkcqmmjfervsyglppdnmzlqiddejgepbkewyseloxftfrgvnrzwkpoxctjabekkctdxlteoebcipuctaealdxjcyvqxyoyhrcdynetmsxrfsmnhbebflxlqxvhkmwapdshyuedowdtlvzcwihl...

output:

120192595643

result:

ok "120192595643"

Test #67:

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

input:

500000
qkzihaydmyrzficpjqcfjeqiulxnhmuuxsxdqhoczpleaqrjqutbvhqrutgmzcxwnjdqlydfstwxmwfwcyrqfkcqmuxfwukqaucxhwcwwmrmajyppuhukwalaoibfepxvrbqgahawhxjldoyyggpfguboepwwugqpaehbhuntrjewvxrlojrraiehmdsmbbatxgzdmshxsodpecltsieylnfrmakirpsowczpapxkiksfbjecmkkvtfmyamjmxwzlolargxdihawnfiqgybwtfiziuwxfxuqtgcny...

output:

120192630444

result:

ok "120192630444"

Test #68:

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

input:

500000
dkzyczkqwwbntyhuyskmqzmkmfjrmtgludstliqcwynyuvockmclfwlsjlugbyztaairsuxiyrtglmwlyynatfjuztqslangpskyeohkpfbxwevfrofvonwmsaqvhtbisotysedzbeokymxfzfjglldnyanyhglptqcwjhdvgeguqvaemjicpogzpkfqwaybwfuhnpfyikgnjvqtmwlegpvgvevlnmebbdgdinxmegbjbfclhyrepzzrreuznhyifkqidfhozhbvsjcduwrtrhexstfxmazxowsjd...

output:

120192637116

result:

ok "120192637116"

Test #69:

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

input:

500000
vfkdcocspqgvmrqeugqknlbvqcaytsvwnmpfbjiwwgxycoaspvhfhjrjnhurlbqwfcqhkxnayqmdimkrbzieieljbtnekkhozlaxbrpqpgmgyndgjuuytuuebrvbrzenfjsjkecakooidcrdsmuyensolidxptcztuvgzdnbhcrdoupoyxqouirttqevqkvowomnpnghwelgawyfcfljplyltdikcdrzxpwojpjlmuzuqxzhbiackjinblawhmwmukybgakebieteojfboipmgahnkgfwidgzpgrw...

output:

120192488423

result:

ok "120192488423"

Test #70:

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

input:

500000
jmdjvrjbafuzjxkukjhksmmnlagxpvkhsssbkopgvpzfebzbtrlerhzwxtihryyhoevzhhyqzubmxcoruiwalzpenvzcvmapbaecchokzukqahbedhuououwtwkttglltfchtixdgkmmirhhisdfheqbmzvtmfnqnubkycjnuyxfiseaiyvnvqvpcnieqoxtpjjdzmoelhehhtxnzkmrftxmdcwwicxknpfbqshadrrfgnxvhypkophvqninlfbpfpilzzqafpzdxlzfreusogvfrgccjtvelxqos...

output:

120192578619

result:

ok "120192578619"

Test #71:

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

input:

500000
yrdzqmgiyxpznmcubxtnurlpaqzogjxvjcywsagkubjmlhiegpfqhwkjyduonbwldtolryjptsanfpsbiktgxqxujguehocrieoszpxojovtetumgzohrtifbjzoxzlztbbvfmciwfkipgkgxulceuebdymcesfmggvhasklotsyyxcugzlhopvghbvckiahsxifbqrnwemmctonfgllutuwfmlkzhfunxaxojpyhcvnilppgicjdarqqxaxpqsrfuucqgkvsnhfyqlezvlfjuhdbwlmsuterrpvm...

output:

120192476955

result:

ok "120192476955"

Test #72:

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

input:

500000
zpuvtbdyepstussunwtflrlevxwtgyupxjeqqnmbewvpfweunnvagpvpxopiyhjtwhhnazdlnimvoqdmrqnxujbfnzaikygzqqcfacqbutqruzixutoacydjpcwiqoqtikljushtsgajkfzwublqrtzshgmzjcbyrppldgjhqxzpqlslluwehfwkenljavdnytfvemgtmltjfadcjacixdspkgiuaviqrwrywdgnxstzghkmwbczgwfkdkkjbkwzyakdtijhitejhcdesjhjljpbjhrduneurbjvz...

output:

120192649879

result:

ok "120192649879"

Test #73:

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

input:

500000
aebnogrjsrroofvrerpkdchdvgfqmcyxtimysanjyuhgwughlcepmmvayldgvuchffuohpfkqprooxogenchkmzpkpoogiavecxwmcnqdgdvldcqxtwpivjxzavxiekvgxalgmtgxxhzgzbjcozjtnnhvuupafeegpjmlmndghpcwujqwuclqzamcoazkrzkcsxrjkehcgmbezllgrrounnvlxtwaxnjvyfcfgkcuhilixfhochltmccmjvmjwqghskutdfjhekcwelnifpwjhmlrhflchnagcfgt...

output:

120192616957

result:

ok "120192616957"

Test #74:

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

input:

500000
hfqzgdzupuwbizzwnxjefenmosmaontwpjdqkbqhkuhrtxyejeevrnojtprcewqwotdqbaihgdfmadkaeebwffrbvjtlrshkjztpmquzvwiiollrsizqxrjbyvigbgkonvnqskwrmmhmbmpmtgmfyahcfljeuozrsaqvroytdbbxzoknwukwxcigmtmjjodochspupoomcnnoahcfyjzzzhrjzcdjhycntkjmmopkqwrrlqepyvogqajjrxflyqirbsxcapwtzeubmjvebjopbctszhezwjdpxgjw...

output:

120192579184

result:

ok "120192579184"

Test #75:

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

input:

500000
cemjlotwogtujggryhoixnvxvqnsqhnomlnmpwwatypjcirzislgkrxplsmnxqutlywdquwtuptekdenemezbasgxabgjsablzqmjvjclpnexxkgypualkgxvqjgsqsyypyfrhbfushtthlbcqmfkoowokzaqvqkbitlxshgmiijeplchtcxlkijuqmsngklenezutneaygjxmwdrzxmppoklhmgxuehdehsqcpjgvoethgueyooooobmroakgvriizgnmgyltdxaqmwzsjbtguubhnigpncyflty...

output:

120192498760

result:

ok "120192498760"

Test #76:

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

input:

500000
agslhnbzpgmkdscnnuelvdtdrzncsklfiupcdgyymiefvturwkxkncfcefnfquygcnaqkzykdmzvwrettdwzvnwonljvjxnebjumzpttdewhufmkzjtnfnepoamfpuxouizexfbkvmkwzggjmqgghjbizawmgxmhayqktufwzsamklnmoekmapfwzhkywnhjsfghaxjvnlzfnnnnyzhfcspzvvlbgvyqzpwkshsddzpospakcjwhbcxemxxuyuflyolhifdalcdwwikwxincechbsabucotfmjxjf...

output:

120192555023

result:

ok "120192555023"

Extra Test:

score: 0
Extra Test Passed