QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#338936#8176. Next TTPC 3275307894aAC ✓124ms26948kbC++141.7kb2024-02-26 15:12:032024-02-26 15:12:04

Judging History

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

  • [2024-02-26 15:12:04]
  • 评测
  • 测评结果:AC
  • 用时:124ms
  • 内存:26948kb
  • [2024-02-26 15:12:03]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e6+5,M=N*10+5,K=1000+5,mod=998244353,Mod=+-1;const db eps=1e-9;const ll INF=1e18+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
}using namespace Debug;
int n,m,k,A[N],B[N],nxt[N],ti[N];
char s1[N],s2[N];
void make(int *A,int &len,char c1,char c2){
	scanf("%s%s",s1,s2);
	int l1=strlen(s1),l2=strlen(s2);
	len=l1*l2;
	for(int i=0;i<len;i++) A[i]=(s1[i%l1]==c1&&s2[i%l2]==c2);
}
void find(int x){
	int y=(x+n)%m;
	if(B[y]){ti[x]=1;return;}
	find(y);ti[x]=ti[y]+1;
}
void Solve(){
	int i,j;scanf("%d",&k);
	make(A,n,'T','T');make(B,m,'P','C');
	if(n>m) swap(n,m),swap(A,B);
	Me(ti,-1);
	for(i=0;i<m;i++) if(B[i]) find(i);
	priority_queue<ll> q;
	for(i=0;i<n;i++) if(A[i]&&~ti[i]) q.emplace(-(B[i]?i:i+1ll*n*ti[i]));
	while(!q.empty()){
		k--;ll p=-q.top();q.pop();
		if(!k){printf("%lld\n",p+1);return;}
		int x=p%n,y=p%m;
		q.emplace(-(p+1ll*ti[y]*n));
	}
	puts("-1");
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 19408kb

input:

3
TTPC
TLE
P
AC

output:

34

result:

ok "34"

Test #2:

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

input:

670055
TF
OITFKONTO
GFPPNPWTZP
CCZFB

output:

-1

result:

ok "-1"

Test #3:

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

input:

910359
TOKYO
TECH
PROGRAMMING
CONTEST

output:

1401951321

result:

ok "1401951321"

Test #4:

score: 0
Accepted
time: 29ms
memory: 14492kb

input:

518530
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

518530

result:

ok "518530"

Test #5:

score: 0
Accepted
time: 29ms
memory: 26948kb

input:

252288
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

252288

result:

ok "252288"

Test #6:

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

input:

1000000
TTJLTTPNTTQNTTBJTTHZTTJSTTRUTTVWTTJXTTMGTTZHTTRWTTNHTTDWTTMGTTIDTTSYTTPPTTGQTTXYTTOETTYMTTZATTAOTTJNTTHHTTYLTTJBTTLLTTNNTTCITTCBTTDOTTNGTTPZTTUETTFHTTODTTCETTKXTTGUTTZSTTECTTFSTTHOTTESTTNQTTHJTTDPTTFKTTCMTTNMTTGRTTYPTTKQTTYCTTUITTYCTTWWTTZDTTCPTTRSTTLFTTPKTTEXTTUPTTXWTTDATTVUTTLCTTEGTTOLTTRI...

output:

-1

result:

ok "-1"

Test #7:

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

input:

359869
TTXTTTYTTTITTTHTTTRTTTOTTTETTTKTTTZTTTYTTTBTTTUTTTBTTTJTTTDTTTYTTTJTTTKTTTYTTTLTTTATTTLTTTITTTHTTTUTTTMTTTDTTTITTTPTTTITTTCTTTCTTTRTTTZTTTVTTTETTTGTTTNTTTUTTTGTTTYTTTJTTTKTTTQTTTSTTTPTTTWTTTPTTTZTTTETTTJTTTVTTTGTTTUTTTBTTTCTTTCTTTXTTTWTTTETTTFTTTGTTTDTTTATTTCTTTITTTWTTTWTTTITTTSTTTRTTTYTTTETT...

output:

-1

result:

ok "-1"

Test #8:

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

input:

856943
QNTJMTFRTNDTXOTJRTNNTCXTZNTQMTSBTMRTDMTMOTEATOXTHWTOJTQQTLITKRTNSTNITSMTRVTLLTKBTSATYVTHXTEZTRXTPNTEQTQDTVZTMOTJVTESTRQTBBTAXTMNTUBTULTFPTXQTIBTCMTXXTMZTOWTYVTPVTDSTMWTZDTGQTVMTRFTKDTQITKSTCQTOPTSRTJWTFCTEFTCKTISTELTWGTHOTODTQHTLETRCTSHTJITQGTSUTFDTFZTFYTBJTKNTMHTHWTOZTARTZGTQETRITMSTXVTZATKJ...

output:

-1

result:

ok "-1"

Test #9:

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

input:

12
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

-1

result:

ok "-1"

Test #10:

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

input:

1000000
WTTTNTTTLTTTZTTTWTTTKTTTDTTTATTTNTTTMTTTZTTTHTTTVTTTVTTTITTTSTTTNTTTSTTTPTTTVTTTWTTTJTTTRTTTQTTTFTTTQTTTMTTTMTTTYTTTWTTTLTTTMTTTNTTTCTTTWTTTSTTTVTTTDTTTUTTTLTTTCTTTCTTTZTTTQTTTQTTTWTTTDTTTQTTTZTTTUTTTQTTTITTTYTTTATTTATTTGTTTITTTWTTTYTTTYTTTFTTTHTTTPTTTDTTTWTTTRTTTLTTTNTTTFTTTNTTTNTTTCTTTBTTT...

output:

-1

result:

ok "-1"

Test #11:

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

input:

506084
TPTGTATITNTJTPTBTZTDTRTVTJTVTSTFTWTNTATYTKTJTCTBTPTPTJTSTQTGTPTKTYTBTMTXTVTMTUTFTPTRTYTVTFTATCTLTITVTUTNTATCTJTYTOTOTMTKTBTMTMTKTQTWTBTHTITATUTYTNTETRTYTWTDTLTCTPTGTKTMTETGTCTWTMTNTKTMTATDTQTWTWTPTMTRTYTQTMTJTCTGTXTDTUTSTBTYTFTKTGTYTHTNTOTOTXTQTITITSTGTUTMTNTPTETJTDTJTRTBTKTXTCTSTRTZTSTWTUTJT...

output:

-1

result:

ok "-1"

Test #12:

score: 0
Accepted
time: 22ms
memory: 19672kb

input:

95378
JTTGTTYTTMTTFTTSTTUTTBTTNTTSTTVTTKTTYTTUTTITTFTTYTTKTTSTTSTTATTMTTQTTMTTLTTRTTWTTQTTLTTWTTPTTYTTGTTPTTNTTUTTRTTKTTWTTHTTVTTGTTMTTQTTUTTXTTCTTZTTUTTBTTDTTPTTJTTETTZTTNTTOTTKTTITTOTTGTTSTTQTTVTTZTTATTBTTATTOTTYTTZTTZTTZTTDTTPTTHTTMTTDTTLTTNTTNTTITTETTRTTYTTOTTWTTZTTGTTGTTRTTXTTKTTGTTVTTDTTSTTWTT...

output:

27097032

result:

ok "27097032"

Test #13:

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

input:

12
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

10636

result:

ok "10636"

Test #14:

score: 0
Accepted
time: 63ms
memory: 19984kb

input:

1000000
LTTTWTTTLTTTWTTTITTTQTTTWTTTKTTTSTTTGTTTLTTTHTTTXTTTFTTTYTTTPTTTBTTTFTTTYTTTBTTTZTTTYTTTHTTTNTTTVTTTKTTTMTTTITTTQTTTYTTTYTTTZTTTGTTTBTTTLTTTMTTTJTTTYTTTVTTTITTTYTTTRTTTCTTTHTTTRTTTUTTTWTTTQTTTITTTVTTTWTTTMTTTRTTTFTTTITTTYTTTETTTFTTTHTTTOTTTYTTTOTTTXTTTFTTTLTTTRTTTFTTTGTTTETTTBTTTVTTTETTTWTTT...

output:

907999396

result:

ok "907999396"

Test #15:

score: 0
Accepted
time: 74ms
memory: 16560kb

input:

713716
BTTCTTOTTZTTWTTOTTHTTITTITTITTWTTGTTFTTJTTMTTWTTRTTGTTFTTLTTJTTDTTWTTITTRTTMTTQTTDTTJTTWTTHTTKTTRTTQTTSTTETTKTTYTTRTTSTTGTTQTTYTTOTTCTTLTTSTTOTTETTUTTRTTETTLTTQTTYTTYTTITTUTTXTTZTTXTTJTTQTTWTTWTTMTTRTTATTNTTSTTJTTKTTGTTHTTVTTSTTRTTXTTMTTUTTNTTPTTQTTHTTJTTHTTETTQTTGTTGTTATTITTATTBTTQTTWTTHTTWT...

output:

563121569

result:

ok "563121569"

Test #16:

score: 0
Accepted
time: 10ms
memory: 16724kb

input:

11522
TXTTTHTTTVTTTOTTTFTTTZTTTKTTTZTTTJTTTDTTTPTTTRTTTHTTTOTTTXTTTCTTTWTTTNTTTDTTTSTTTWTTTCTTTHTTTXTTTFTTTSTTTOTTTHTTTCTTTWTTTUTTTXTTTSTTTZTTTXTTTLTTTETTTKTTTLTTTXTTTLTTTVTTTATTTLTTTHTTTDTTTITTTQTTTLTTTKTTTETTTATTTHTTTYTTTOTTTDTTTSTTTCTTTVTTTRTTTITTTITTTMTTTPTTTNTTTJTTTXTTTKTTTXTTTGTTTCTTTUTTTCTTTW...

output:

11152921

result:

ok "11152921"

Test #17:

score: 0
Accepted
time: 10ms
memory: 19396kb

input:

1000000
YHTTKJTTFNTTMITTNWTTOETTWJTTCFTTIRTTVJTTJMTTHOTTBITTLXTTRLTTVLTTOFTTMYTTOGTTAYTTVLTTCRTTENTTLKTTKETTXPTTSFTTCZTTGLTTJZTTGFTTOYTTSFTTLHTTNMTTANTTSGTTKKTTXETTABTTSBTTLLTTQOTTNDTTWATTERTTAUTTMWTTISTTASTTZJTTPXTTONTTVGTTEATTVBTTXGTTSITTPNTTLITTLQTTHVTTKOTTQGTTVLTTDQTTLHTTJETTWFTTDFTTIQTTIETTKHTT...

output:

-1

result:

ok "-1"

Test #18:

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

input:

1000000
TTXZTTYMTTVYTTASTTUPTTABTTLRTTEPTTQPTTMKTTCOTTPKTTPGTTSITTDRTTQSTTCPTTXWTTXBTTJDTTZNTTIPTTIOTTKJTTQITTEJTTJRTTAQTTIBTTAETTUOTTUETTDRTTNFTTPZTTYHTTMZTTQDTTCDTTVDTTHNTTXKTTUPTTFPTTYFTTIUTTUBTTJATTYFTTJWTTGUTTPXTTIPTTHSTTVATTHWTTWZTTMSTTJRTTYWTTSRTTUPTTDQTTKJTTIUTTVBTTNOTTBGTTINTTAMTTRNTTAXTTDW...

output:

-1

result:

ok "-1"

Test #19:

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

input:

367325
TSITTGUTTPJTTVDTTSSTTIJTTZATTKGTTPATTCKTTBWTTYKTTRUTTMOTTUQTTEDTTFLTTYOTTRITTYVTTGXTTVJTTWPTTVDTTAFTTSOTTJZTTDKTTBUTTSPTTFSTTHXTTKDTTVJTTCUTTALTTRHTTAJTTZHTTZDTTAOTTJVTTLKTTSXTTFITTDPTTGSTTXRTTEITTOQTTEPTTVCTTSITTJUTTPXTTZWTTPKTTUZTTLWTTYBTTFETTJYTTLDTTGSTTIITTKFTTKHTTUGTTVPTTXNTTFCTTLZTTYXTT...

output:

-1

result:

ok "-1"

Test #20:

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

input:

1000000
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

-1

result:

ok "-1"

Test #21:

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

input:

1000000
NTTNWTTJFTTLMTTSATTRWTTEXTTBETTPBTTEBTTXPTTUDTTWVTTWMTTWZTTCATTSBTTKBTTEKTTNHTTPBTTCATTVITTPJTTCYTTAPTTVLTTDHTTVQTTJUTTCFTTLXTTODTTFMTTXRTTRLTTNPTTVNTTYMTTOXTTDUTTVZTTSDTTMPTTYCTTLKTTFATTCETTUFTTGDTTKVTTGYTTVATTYZTTQRTTWQTTMGTTFXTTLDTTXRTTGFTTPLTTQQTTOVTTEOTTJSTTXSTTQKTTRVTTWZTTKXTTRBTTRRTTM...

output:

-1

result:

ok "-1"

Test #22:

score: 0
Accepted
time: 124ms
memory: 20516kb

input:

1000000
DTTTATTTBTTTUTTTUTTTNTTTDTTTITTTATTTRTTTFTTTJTTTZTTTDTTTRTTTETTTWTTTCTTTHTTTFTTTBTTTJTTTUTTTWTTTJTTTCTTTETTTYTTTHTTTWTTTETTTWTTTCTTTZTTTWTTTYTTTKTTTRTTTLTTTVTTTETTTOTTTDTTTPTTTLTTTMTTTWTTTCTTTXTTTDTTTPTTTVTTTFTTTATTTKTTTWTTTOTTTUTTTPTTTZTTTMTTTETTTWTTTRTTTPTTTRTTTHTTTFTTTYTTTRTTTKTTTJTTTETTT...

output:

452272320

result:

ok "452272320"

Test #23:

score: 0
Accepted
time: 62ms
memory: 17484kb

input:

1000000
CTITITNTHTTTBTZTNTMTFTCTZTJTRTBTUTPTWTWTNTUTMTUTETITITATKTMTRTPTVTXTPTHTNTGTSTMTUTWTKTWTITBTCTHTFTWTDTHTWTBTSTNTNTCTGTVTVTVTMTVTITWTJTRTYTETMTKTFTGTPTXTHTGTXTVTPTHTKTSTMTUTMTLTCTDTHTGTUTVTPTYTQTOTBTMTZTZTWTOTFTGTATBTFTQTNTPTGTLTYTKTPTCTFTATSTDTQTBTXTATVTRTGTITSTITDTKTPTNTKTKTBTATWTKTRTBTMTDT...

output:

975999035

result:

ok "975999035"

Test #24:

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

input:

11
WHLKKWTICHLBXNJKGGFGQLTLEHQUIYKLQZVWFFAVIDVCVJHUSJTYQTIJECJNQCLEJNZPKMPVBPKZHENYFXCSXZEUVJAFLMWIZPDWQDNRPBIGBTMNQKQOGJFEQYDHQYIBZXHBMWTJZJJWYWCQLEDVCUVCDMPEWOXGRADJQGRANTLNMTMHALLKTZYLFZPOPTOGKSTJBGJEGKBONVGJUSQDPBTECDEDGHAZCZOMZBMXVVTNMLPPLBVHLZXASGFRAIBAULIYDEHASZNGQDUBZCRTZYIXBDYWAGOIGCOAAPPON...

output:

6385324

result:

ok "6385324"

Test #25:

score: 0
Accepted
time: 10ms
memory: 17548kb

input:

14
UCBNFDDWTZCYVRYRQCEWBIVBQADDGNHJDJIPZMHCDWLAJDEJXIJIQTUOSNEUONNQIMOCRLSQXBPHDPQYBJLRQMANSCKNMCORGLIGAVBZQWQJKZFYDARHAZWYQOWYBKTWYESJAXNWDEEITRMCAPWAVVQQCCKQBSIPEGYZQXHYLWFOIYQBFESGUABSXJTOLACYNAUGFXJIBICEDPFLCUGQPDVZVGXRBKSHIDMFGEAAAPVCEBZJIZJQJTXQEPLZXFUQYWWPBQIDQDAXCGSBJNMBVOQTPWMTVVIZZTZZNOLBN...

output:

3768074

result:

ok "3768074"

Test #26:

score: 0
Accepted
time: 42ms
memory: 18444kb

input:

621991
PHSWLBLHWDNEUDLSMTKUPSYGZVVTXZVDFLIJERLKFTKBCPATGFTPXCYHAHBCPCFDBHHJMGDDIHSCNHNJMDPGMXXBSVCQMWALQNVOVWESQDBUTDPUMOUFTIHPQPYFUSWARGPFZFVUNNRUBOTHERYQVKCODQOMKXOAKSQEOVEXDNCHYNIVKEJJVJSZSSCQKXDWVMSWEXXKOYMQZSGCLTFQIRZMVVXXPJSGDZWRZYIJOLGGZCAHKUGSMEOHLJZKYZGIEHQDAIGBAPTJQIXUCMZDTDPAWACGFJWUWPRVS...

output:

285656877012

result:

ok "285656877012"

Test #27:

score: 0
Accepted
time: 56ms
memory: 18868kb

input:

681065
BPEIWKXAPGASDFYOVYWFZIFZJCTSZOHAXWADMHJQZAVYZDMYUEBGJMPIFDQIHSWKJZKXDJGLUMRGBSVFLDRWGSDWDXBBNMQFDJLVGSEHCFWYINVJGCGIOXIFVVQWYPVHSMOTSCJLYFNHBWNZHHYBGZKRZBPAYJFRZOICJOOBOVXGEIUXMGEUVYSFUPITQGHGFUPHCPJLBRRXUBLQRQVDSFHCYODJXQJZJKDZWEHLQRJIONJGGDJHXJUTJSXYKXHCAXRLXVRQZNXNZWMUCVXQLUPCIILGAXCDZMQHV...

output:

640624135227

result:

ok "640624135227"

Test #28:

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

input:

36576
IRMNJPGAQZMFDZACMEVLGQSDJLXFAZDQRXSIDMSYFRDHZVQRDZBVXMMMGAPYFJBSHVDQVASDYGLCWKADPAEFHBAXIZWXSMNJYEKSKKNAKESFUQEDOLDZYOIPVSEXKVJPHMZGXOYLWDNJBPRIISSWDYPGICCCERHMHCRYNZFPMYXXUPMAWPUIVGKHCJIQBQPPEDZDXZNUFQOCKZRSRAKCMVMSCBVFAJXUAVFZVUFERGHDXFMHUBOLXCJCNSHIEHNBWJYKOEUTXMKBPGQKWQZRLXYDFTCWLBBIYBFTYS...

output:

1631600024900756

result:

ok "1631600024900756"

Test #29:

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

input:

870492
ADNCVEKYFEDDSBIFJBFNAIHWGFWXLWYGROVNMWHJPTPCHMMFBYAXZFOUBOOCXQLEHLQCHJVJVGSMNPFNHHWOJBMDEASWBBALXBSFXXFVLIBEUMXGSNSKLEKOQGYHRLENMRRKNIURCFVQSXLNJJJNAYYSPFCILXCGCRFCBZDQAHKACQNFDSNKBFYDROLJPDKWZVLAJCUVIFXEHVGKXXKDKOOXFHKSARJMVWXGUYWUCDZOXNFHMYPJOECWNOXQBBWDOSSYUMCMZWSNSXMCBXNZHISVKLDJXABDKOVQH...

output:

2249019642670992

result:

ok "2249019642670992"

Test #30:

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

input:

699084
DMSSXMPXNYSUSGIHNSJDADZYKFGERGBHUVBJQLNZPBQSVFKZNAEGQJCGBAQVBMCFOWAZEJOEPIYSAKEEIDKVBMHVZGUWIGWGHDWMRCXDVAAWHSVMBCVCFLBMMKEJMMUSGWKXZXLKRQVDLUGLKBXCKOQLUOAOXMKUCIMNYVITJYFQPYCAISGUXPPXJJXBWRHCUQSBOXFMZDHUOMIRODDJVQIINHHSDKLDZLZOAOQXVJGCIYWVFLNLRQYLKSDZJVQNNRILUZISWYYKYGESNBPIWDRQKAFVZMUJZKJAC...

output:

2238903359576856

result:

ok "2238903359576856"

Test #31:

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

input:

1
YBBQHUMUHPCOXASQLWBRXUPEORMGCOFIVNDFSNGFJRWRYPACZSVJGKMMLJRUVOVXDVPAFCFXOAXMDGNPCXLZCHGBFCVYYOBEEOIFSNGFRINXEXUGSWOIZUJFFBVOEXPRSOIONPWYRQDKAHUKOVUJKXZCSLVIBWISZLDMXXICKVSEUALMNDLHNHMFBGXSSXJPBEPRBLJXBUIUGEZGUEHNEQAMENIDVJJYHZCPRFUKLRYFGPVYRDIQSEKKEZFZGQUFPSHQLZFMQVQXOMHDRXFMFOFVLWBMNJPIAFYWMFSQDQ...

output:

42737103431

result:

ok "42737103431"

Test #32:

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

input:

1000000
MJIRPODODXHXEGOQKDVQXFKONESHJFWAKFOURAPYCPHRCLUDISEFAOAWWMINVAMUFUWJEWCWYZJDPAVQJPULSSKPNLFHXLNXCYDYCJAYBIHSEHVCWBFXPFQVVRDGMCLPQQSRXDMEOGXPYNXHFIXDVXZRCYOEHUVSEIURMHSPILBWKCZFEYVGZGJAPUMIJIUGQJHESQMLXYKPHHQNGYMVOLJUGLLIWBNPYJMKVLUSLNFWAHFMENNLIDDELSWTKPWRSDXQDSDPAPQSWQLKXODALELSLZSELOQLXKEW...

output:

3392859102435868

result:

ok "3392859102435868"

Test #33:

score: 0
Accepted
time: 28ms
memory: 19656kb

input:

350208
TLTHTUTTTIECTJTTTTNTTTTDTZTHJXSZTVTTTATTJHTKTVDTTXTTTTTTBATTTTTTXTTKTTTTKTTDTTTTNTLYXTTTTTTTFJTTVTTTCTOTZNWKTRPTKTEKETTTTVRTVWCUTTTKDZWVPVMMTTTISJTTTQTTTETTTTTMTTTTRTTITTTLTTMVTTMTTKQTTTWTTTBTWTIGTCTZTTTTTTNVTYUTTTTTTIOVTTHITTSTNZTTTOTTRHTTTTDHTTTUVPWTTTTTUTTTHMLFWNTQTTTFHTPTTRFITNDFTJNCKESTI...

output:

1248723

result:

ok "1248723"

Test #34:

score: 0
Accepted
time: 45ms
memory: 18876kb

input:

343585
TRTTTTTRTETTTTQTTTTAOTTTTWTTSTHTXSTLTTSITTTDTTTHTGTTTTTTTTTBTTTTTTCTVTTTTNTTTZTTTTTNTTTUTZTMTVJTTFTDTTTTTTTYLTTTTNXTTTETMTTTTTOTTTTTTTTBTPTTTTXVWTTLTITINTTTTTZTTTATTTPUTTTTTTTOTTTTTTTTTSHTLTTTTTTTTTTTTTTTTTPXTTTTYFTTAYTPZETTTFTHTAOTTTTTTTTTTTRTTOTTTTTKTTTTTTTTATTTTXTTSTTTTTTTTTTOTTTRTTTTTLTTL...

output:

1468088

result:

ok "1468088"

Test #35:

score: 0
Accepted
time: 14ms
memory: 21952kb

input:

1
TTTTTTTTTTTTTTTTTTTTTTTTTTTQTTTTSTTTTTTOTTTTTTTTTTTTTTUTTITBTTTTTTTSTTTTTTGTTTTTTQTTTTTTTTTTTTTTTTITTTTTTTTTTTTTTRTTTTTTTTTTTFTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTMTTTTTTTTTTTMTTYTTTTTSTETTTTTTTTTSTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTETTTKTTTTTTTTTTTTSTTTTTTTOTTTTTTTT...

output:

1

result:

ok "1"

Test #36:

score: 0
Accepted
time: 69ms
memory: 16308kb

input:

1000000
IHTTXXQVDVKETTPPWTTLLTYATTBCETCLTSEIXTTGTTJTTXBTXTTVTTTTIFYTASPDBTWVHTMVBTLTHTTQWTTTZAIATTDTTTTHGJTSTEZVTYPTTXTTTOLWTEFTEIHUATPTTQWTBVYTTCTVXZTDZTTTZZTMULPUSATTTITTEWFXTZNPTETDTLTUTNTDCTPLITDTYMWCTJTHZTTFTHJNATMBSDJTQTZTYDWFTTQAJTOKTTQKTTCUVTTAVXXUTRTULOTTTUUUZMRMITTTXHTTGTTTOBUTKTMTBPHTTTTT...

output:

4223102

result:

ok "4223102"

Test #37:

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

input:

345046
YHNYBBTUCRWJTYITEQDYYTEHAGBWBETO
KT
JNFETZVTCUHLGMPNGVMWZZFIXNFGUVSSEBSKMZUJSCFVCDTWPCPBPSPYTKLDOAOLRJJLESLGLOVQLDJMHYSQACKIMABZVTMLCPCAQEXDTJFBLNYCNJWJDDSAXEEICBXVYQGYBPXVNFCHIIXKUMMQXOEMNDYBGNGEJJCQIHHLYFUIZNJHUGSRKVXFRRTEYTCLVWTOSBNFBLZPSSPUFGMMLVYTADJGUGJYGKQCHOCNIZCPDNFLFVNBAHTGJAFKGPJLL...

output:

3140057680

result:

ok "3140057680"

Test #38:

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

input:

990105
T
T
FTBLKZUGHSNFTKEUEFRULGLILYCTYPKXZJGPQTUUYNZEOVXWTHZDKUMINCMNMZVQDLVVFLKBBFAWUQRFJLHKBRZFNKDOBNVKWQEKCBFXCUJGEGTUPKJHGQEDFEVXTNVUTJEMIIYWJMHVXDABJPUAXZLHXFRMKFMOFUPKTNELPOGHIABOSMCKQPQHEWKCKGGXTAXMAGXSCKXBMHSVMORIDRLLXWCUCYTUIROUNUNBIDNAXBQSDYWNVTYKRPWEJDWJRIIACNIUPXJUKAMPAVULCAKXGVEAXYTDT...

output:

866652802

result:

ok "866652802"

Test #39:

score: 0
Accepted
time: 33ms
memory: 19228kb

input:

749386
DUGGXTKUUHOZRLDPEVBNGEZUQPUDQFGHYQNMPMJRMPSFVFLECMGXNFDPQZIQCIUDUBNVIRAMTDMDDQRMJZEMKVEDQWTJIUUQOMHGEQETZUWIIOXPRUMAYLEGQDNRATLWXLYSYWMNOCBPITAKFYBMXDPOSHNZIEOWXCWDUNBSPNVONUBUPANOITVOIRJNEXUIWWLJJNJAMIMHLFMVHISWXDXNAYGTTKXRNEYTLKBKDULTHDBMSLTRHTAYRCGCCTPZEYHLYEWOFNQXOOIOGSHANWZGGEZJPVNJDFJVS...

output:

5798101706

result:

ok "5798101706"

Test #40:

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

input:

866202
UXTLRNTHESMXDHIJJQMRBZTFUVPADFGJWOEYLEDDHYCBJXXCHWTUWBDSKUDMFBHOQEFTPECMBFTSJKAPNTJLWSJCTHDKPLEKAZGZBXFZBNURENZXPJDSGMCTLAJNWKPZRWNDNJUAEOBZLYWFUSDCEVVADQZMVZVMFWNBBMSGOTDHGVOPBFLEYIQEKHOMADATVMIKFJUSNUCMZKFTTLQDNGCFNXYVMHEEFQUVPCCGKPXBXDPUVHWPYVGMOBAQDANKOWKTDATEPPINMNRQLRWPIJPHMJEMRINZZDDQI...

output:

23920713675

result:

ok "23920713675"

Test #41:

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

input:

610175
LMSBGVAMNSLAUVFWKDZOQFMBUDYXLKPRYOKNBWNPNNGNOMHAJZKXKIURGJQYZFOAKUAAMOENJFADLHXRLAXCXZEMUFRJAFDOGNIYZIQLPFKJGRJZUHSWECQRVACLYXDBRZAJRANHCFCRWPXRVNJSYCXBBMSXFSIRSBNBVGNAQCPQNLZMUIHYKJYWCDHHKANZUXWWCAVPSVSLEJSCCUAUEORRMADXIAIXUSLEUQRUDGHXIPDVPEZRADAXXVENMHGSOXPKKZGKNNCVSKGCKSZLZWVJIHMLAZXFVRUQH...

output:

-1

result:

ok "-1"

Test #42:

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

input:

756402
XSCBCBAPCCEYMGHJSUVDLMSSKUWBEQWFBWGEORUIKDAEKLGMAZRZJSARWQJNJGADAUVAJCMJJLHUWUCRDXSLBIGARBXRBONWZYPFXLNLUCLIIJMWVLAVXPBSJHCBXAPHGGIQDSGKOXJCALHCALARIKDNYPSHCKIESGSMULRBRJSAMFPOYVZOPNAYPCGBHVVWDDMNOUXWAFDVXORXMAYPYZAYUCDFLGKJERDJZZZDAVBDQPBOXEWUBNECAPJJXWKHHRIQVQRJVQOPJDAUYLNLPZDMYKRFGFLIMGYNO...

output:

-1

result:

ok "-1"

Test #43:

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

input:

919744
USJEGOJVYQVJIGPJCGEIMWJIPVBISYGBFEQXUFEIICJUNOLOKGNFJODMSRFRRKJXLJWQBPFFVJIHAWXZEWUJDXUHYEJHODCQFHUHZGIRKBJDPHDZARJZZZXULFVUJCWAKDEHWQIZDGKXEWIOIXXDRSAYJPVFVEDSFDVGHNWYRFLWHBWDDYBCRYDWWWQGCPOXLCQEUYXGNLOMXWPYQAZCMFGDZYZNKUKGWCMPDGZKQDQPNBOLRDPQUWMFOCNRRLXUDESUCDHQSPLXCGXHRXVFWQCPCLXDPJDIXQASG...

output:

-1

result:

ok "-1"

Test #44:

score: 0
Accepted
time: 14ms
memory: 20136kb

input:

178094
HZWHPASQGCMRKYNSKGRXRJSSNSOLLIGZEENWSGMGLOTSKUELOFMOEHRAOSOOMPTEYRNLCOKTZGMOORBSCTKEPBRSMMVCSIYDCLHYRNRBMNIZWAPEBXANQGFDCIUWYXXMSOTGLBYBUWPOZJMSRSBVYMUKJECRZOZPSILNUOTXNISNQYCGQVYIEHNLLLKLEWONDQLRTGQNTFIPEJNYTKFCOZNCCQBGXTABPJWFJGGUUFRJKDMUBXQWWIMOZMNMMURSTVIKZFNSTJFUJVUVGJVOWCZDNJQQIDCDZXFOY...

output:

101851007373

result:

ok "101851007373"

Test #45:

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

input:

39543
AQPXLJNTTQLCKBXEYORIHKWPLZLRDSIOGTQLDQRLOZKCNFOAJSVRSWQZRJPKLJPUNGYTUWNRXBMDONTILKYKYLGNKGBFTTOKQWYDDULORMCAEEIDPJLBHKHLULTTRQLOPONMWUFZWSRFHHHNVKUVMRNALCTKSJUPC
SLUDMGAUPMFSUYJLEATOTPVLJIRRVFXXUVPKYUINMHEUXHLHCSAAFCJUSMPLUOABQUCZPUIDIDDSCDDOGALBXTVHZONATVYSYOIQWAIZFGPBLCBUAMAXTRQQGGMJAGETSVBM...

output:

10428475413

result:

ok "10428475413"

Test #46:

score: 0
Accepted
time: 32ms
memory: 18104kb

input:

513749
FTFAAVVEXZFCJHJLRTXHZBMFWRZZJFGCAFKJCRLJGXNCGNWTHEIMSNFDNREGTRKBYPBQFOGHIIXXQHALXTQFKQUVQJDUSNQFEUENDGMMHKTRFHQTYCAOWJWVNCVYIBKHXMAGDXXIOARCQZZFMRKPRYYPOVFSPCRCBNEPIVSFLMCRAFFXTAVBLQDFXWCFIFSMPOHRZPVAWZFXKSMQNXDIDCVBKKATUEJFUIENPGRCLJMBUJADEUAYAZPACDTKUUMUKMXKEAKJMFDBQWMKZSDEPZIPWRKKOJQONPKCZ...

output:

297904535175

result:

ok "297904535175"

Test #47:

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

input:

323568
HPCBEXJKHBICZDFYOPUZNIQSKEYEYGWNWNOUBKXZMPPYMIGWASAESQDCQELHRDQZHDNVBJVAOPSRCBQIYPLSQJXMFZXSYESFHXPXIABQLIKDZZKTFXEOIFWLJXHPKXUJGGUQLMRAOBQDQRKHQFMOUAVFBCIDFHCMRREKMXDJRYBFJNDDQCZAJRLVMZFEMFVYKOSIWAXUHSKEHKONJGSOUBLAAEAMBOGYVIDHBTPDPGJKWMBNNOEUCPWLEBHSHLISZMLSNKQQPIMJKMWIGINMCXBNJHWIJKFQAJPYQ...

output:

195139073323688

result:

ok "195139073323688"

Test #48:

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

input:

999097
JMLDZBUFHJCMCBZYSICXVXSAMWHRXBKGLRINYIVJFMREUNGWXGJHXJCRIBDPCCYBPSNUAGERMXJHRVPLHVGFGBZBXEDZZXYVXNQRLDNOLJMHALPKLOWTZVTYVDAVSJXGDAQNSGHHMNEAXBKBVCVUMAPUUJKLUQIYVMIZDGOCWOAFXNRQNSJNCHLHMJGBQBFCQMHFNKUABXPNEINEZMWCG
XKZOCCLIDPCRBKZUZVWNYHEKNEOUEJMSRFYCLLKPBPSSCXXZIXQQQOGYVDYXJOGPPIROKXONZLBKUJR...

output:

-1

result:

ok "-1"

Test #49:

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

input:

655651
CIXDKABYGNOFBFJPZMQHEVRRUGCIVXAADZKVXLGXRKWSOKESCXMGJYRHAVKRHGNWRQIUWRHHQMYKULBFOEVUDSIGGNVABJFXWQOTDUSRDEYQZOHNPKJEZCIOJIBLSYKOXCSYRBPNKWZZBIRZLRBVKJXFXQUQRPCQKGMOKOBTYYQWKJILUCZQLIYLLWDOLRZEQUEDYHQLXSXCBWRFMZHPUWPRMSHIROBBEVXRSFCWOUULSZWRGHJKSKWMIISEIGYMXQHKKBCKGIVWJOHWQPVUFGNJQUYJXHCKYSYCW...

output:

2634424714338390

result:

ok "2634424714338390"

Test #50:

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

input:

622657
BOEINRYGECRHNYPWZVYUZBIHUFQESGGOBLRUGOIDJEJZFSANFJRXLCKZPVBJCARZEZBXVEFSBPIJSJWXEMWDXOXPPHDLVQKKJDDKCSKNNHFASMSBOHOMABBBNZKSYIASGIUEWLMLVOXDFOFSIVOGWFYFMDEXJANBURYSWVBXZHRIYQLVPDMNKJQKNJRXCSMSOOIXELGDLKHSPVVLDHJIZKYAQRXHVJBDUNBUCIPPBSXXZLIVJRLSIPFGRYJOSEXQJIAYWAAJDPQISAVYBZFKAPWJFBGJXVQVVIMSW...

output:

-1

result:

ok "-1"

Test #51:

score: 0
Accepted
time: 50ms
memory: 14220kb

input:

1000000
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
TTTTTTTTTTTTTTTTTTTTTTTTTTT
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

output:

1000000

result:

ok "1000000"

Test #52:

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

input:

1000000
GTTTQTTTNTTTXTTTQTTTLTTTZTTTBTTTKTTTBTTTDTTT
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
PERYPSRBPGFUPTIAPBWNPVLLPJCYPGTHPSHL
CCCCCCCCCCCCCCCCCCCCCCCCCCCC

output:

-1

result:

ok "-1"

Test #53:

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

input:

929626
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
ATILTXVTOBTSXTNVTHUTUSTCWTBGTKSTWMTOJTVPTS
PWPPAPPKPPQPPVP
CCCCCCCCCCCCCCCCCCCCCCCCCCC

output:

-1

result:

ok "-1"

Test #54:

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

input:

1000000
TTTTTTTTTTTTTTTTTTTT
MTTMOTTULTTOITTWJTTAOTTGMTTBXTTB
PFUPPKTPPOWPPLZPPNOPPKGPPLIPPGBPPQGP
CCCCCCCCCCCCCCCCCCCCCCCCCCCC

output:

-1

result:

ok "-1"

Test #55:

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

input:

5633
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
TULTWITPZTXJTXQTGFTPDTHVTKB
XPPIPPTPPVPPOPPIPPAPPLPPPPPTPPWPPMPPEPPKPPHPP
CCCCCCCCCCCCCCCCCCCCC

output:

253465

result:

ok "253465"

Test #56:

score: 0
Accepted
time: 30ms
memory: 19280kb

input:

1000000
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
TQYFTPAZTCWHTSHRTWKVTTBCTVTJTNVU
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
BCCCXCCCXCCCWCCCPCCC

output:

15999995

result:

ok "15999995"

Test #57:

score: 0
Accepted
time: 14ms
memory: 14164kb

input:

1000000
ZBXHCHSZMLVPLQGGTJDROEZBFDEQ
DKDOKMUWXYLODPABTHGCFRYICACVVDMICSOHBUBPHUWOI
CIBJMYEHQHLLWFYSPJJCGTDAYNNWUAISUYUZEDOGRCD
ANOJKQAXPJTNDGSHCQSDSAFBXWDDKRVHEQROPZKZS

output:

2221377778637

result:

ok "2221377778637"

Test #58:

score: 0
Accepted
time: 10ms
memory: 17600kb

input:

1000000
WZENZHGEFMTHAZKSMODUCBNFDDWZCYVRYRQCEWBIV
BQADDGNHJDJIPZMHCDWLAJDEJXIJIQUTSNEUONNQIMOCRLSQXB
HDQYBJLRQMANSCKNMCORGLIGPVBZQWQ
JKZFCDARHAZWYQOWY

output:

1080349150532

result:

ok "1080349150532"

Test #59:

score: 0
Accepted
time: 17ms
memory: 17528kb

input:

999931
YZQXHYLTFOIYQBFESGUABSXJOLACYNAUGFXJIBICE
DPFLCUGQPDVZVGXRBKSHIDMFGEAAAPTCEBZJIZJQJXQEPLZXFU
QYWWBQIDQDAXCGSBJNPBVOQTWMTVVIZZTZZNOLBNUVDGDBHAL
SEAMROELTNSNJHCSUONPLHIWTILGSKZZSKZEBVS

output:

3917276603931

result:

ok "3917276603931"

Test #60:

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

input:

1000000
BIHBPVPHYTWZXITHWCEXISNZDNTCZEBTNHZFWIOAEPZCOBUNWL
OLIBUOONULIOXSTJTQGSUQDIQEJFOTOTIDKIWZRAP
ENGELUGMJLBACDRYPHEKPPVPXQIURFGOYOMUOVEKYLQUIMWF
APRFKDFOUVYYOAAMCTYWCHFITGVIMCCEQUZDPJR

output:

13324982182

result:

ok "13324982182"

Test #61:

score: 0
Accepted
time: 19ms
memory: 14196kb

input:

757219
SWEXJTINTTWDVHGIRGRWKBXJLSEHPLHTHTDUDSR
KEHMUTHUGBTTACTTG
EEYLFRCHPVUCUPTNKCEIYJWCKRCFLJDPPBPXTIJI
AIETPYGASHCOOXKHCCRPXCJFKDFIYXC

output:

996058294

result:

ok "996058294"

Test #62:

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

input:

629201
TT
VTTTT
PUTLPFRQRP
C

output:

3146005

result:

ok "3146005"

Test #63:

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

input:

147204
T
TTTTTTTTT
PGFQGLP
ZKLCQ

output:

2576064

result:

ok "2576064"

Test #64:

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

input:

805507
TTTTDCVT
TTT
PPPPPJNPP
CZCPVKPCB

output:

3866419

result:

ok "3866419"

Test #65:

score: 0
Accepted
time: 22ms
memory: 18580kb

input:

524954
TPBTKTTGTZTYPTJTTZOTTSFGLTTLKTTTTTTTTTOJ
TTTTTTTTTTTTTTVTTTTTTTTTLTPTTTTTTTTTTTTTTTBTTTTTT
PAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
ZDOCSCCBCLWUCJCFCEMCANCKCCCSUCC

output:

2352475

result:

ok "2352475"

Test #66:

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

input:

127002
NCBTQETTQTLTTTTXT
TTTTTTTTTTTTTTTTTTTTTTT
PPGPPPPPPPPPPPPPPPPPPPPPGPPPP
GICCBDGADCCTCCJXNCMMCJFCCGLRJXCZCZANYCCFSAXPWEFGC

output:

841691

result:

ok "841691"

Test #67:

score: 0
Accepted
time: 50ms
memory: 18068kb

input:

1000000
KTTFJIMTODIDGTDJDTPTKMDTTIPBUTTGWGSPRXNJUKT
TTTTTUSTTTWTTTBTTTMCTTCTTTTVGDJTTWTYTTTTTTFPTT
PSPPGWPPSPNAQPYPFUPPPEPPPPPXPRPXJPYPHPU
ECCCACLCZCCCCWCAXCYUCGCAHVYJSFCMD

output:

26472458

result:

ok "26472458"

Test #68:

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

input:

936720
TTCTOGTB
TTSVEZEWXWTQYRTOTNAZGZLNNOCXTHTTMQN
BHOIRHPUNP
OQGMCHXRC

output:

147533297

result:

ok "147533297"

Test #69:

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

input:

1000000
TTTDYJTTT
FIZTUUTTTTTTVITTDNTTHOITXTTYTFTKTFTDTBHXTK
PLPPPPPPPPPPVPPPPZPPP
J

output:

-1

result:

ok "-1"

Extra Test:

score: 0
Extra Test Passed