QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#359870 | #8176. Next TTPC 3 | Delay_for_five_minutes# | AC ✓ | 594ms | 131488kb | C++20 | 3.7kb | 2024-03-20 22:39:55 | 2024-03-20 22:39:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const int N=2e6+3;
ll lcm(ll x,ll y){
return x*y/__gcd(x,y);
}
ll exgcd(ll a,ll b,ll& x,ll& y){
if(!b)return x=1,y=0,a;
ll d=exgcd(b,a%b,y,x);
y-=x*(a/b);
return d;
}
pll excrt(ll m1,ll m2,ll x1,ll x2,ll x,ll y,ll d){
ll m,c=(x2-x1%m2+m2)%m2;
ll t=m2/d;
if(c%d)return {-1,-1};
x=(__int128)x*c/d%t;
x=m1*x+x1,m=m1*t,x=(x%m+m)%m;
return {x,m};
}
vector<ll> mrg(vector<ll> a,vector<ll> b,ll m1,ll m2){
ll x,y;
ll d=exgcd(m1,m2,x,y);
vector<ll> res;
for(ll x1:a)for(ll x2:b){
pll t=excrt(m1,m2,x1,x2,x,y,d);
if(t==pll(-1,-1))continue;
res.push_back(t.first);
}
sort(res.begin(),res.end());
return res;
}
namespace NTT{
const int L=1<<21,mod=998244353;
ll qpow(ll x,int y){
ll r=1;
for(;y;y>>=1){
if(y&1)r=r*x%mod;
x=x*x%mod;
}
return r;
}
ll inv(ll x){
return qpow(x,mod-2);
}
int re[L];
ll w[2][L];
int init(int n){
int len=1,bit=0;
while(len<n)len<<=1,++bit;
for(int i=1;i<len;++i)re[i]=(re[i>>1]>>1)|((i&1)<<(bit-1));
w[0][0]=w[1][0]=1;
w[0][1]=qpow(3,(mod-1)/len),w[1][1]=inv(w[0][1]);
for(int o=0;o<2;++o)
for(int i=2;i<len;++i)
w[o][i]=w[o][i-1]*w[o][1]%mod;
return len;
}
void NTT(ll* a,int n,int o=0){
for(int i=1;i<n;++i)if(i<re[i])swap(a[i],a[re[i]]);
ll R;
for(int k=1;k<n;k<<=1)
for(int i=0,t=k<<1,st=n/t;i<n;i+=t)
for(int j=0,nw=0;j<k;++j,nw+=st){
R=a[i+j+k]*w[o][nw]%mod;
a[i+j+k]=(a[i+j]-R+mod)%mod;
a[i+j]=(a[i+j]+R)%mod;
}
if(o){
R=inv(n);
for(int i=0;i<n;++i)a[i]=a[i]*R%mod;
}
}
ll t0[L],t1[L];
void multi(ll* a,ll* b,ll* c,int n,int m){
int len=init(n+m+1);
memset(t0,0,sizeof(ll)*len);
memcpy(t0,a,sizeof(ll)*(n+1));
memset(t1,0,sizeof(ll)*len);
memcpy(t1,b,sizeof(ll)*(m+1));
NTT(t0,len),NTT(t1,len);
for(int i=0;i<len;++i)t0[i]=t0[i]*t1[i]%mod;
NTT(t0,len,1);
memcpy(c,t0,sizeof(ll)*(n+m+1));
}
}
int n,l[4];
string s[4];
vector<ll> a[4];
vector<ll> b[2];
vector<pll> k;
ll f[N],g[N],h[N],cnt[N];
int main(){
ios::sync_with_stdio(0);cin.tie(0);
cin>>n,--n;
for(int i=0;i<4;++i)cin>>s[i],l[i]=s[i].length();
for(int i=0;s[0][i];++i)if(s[0][i]=='T')a[0].push_back(i);
for(int i=0;s[1][i];++i)if(s[1][i]=='T')a[1].push_back(i);
for(int i=0;s[2][i];++i)if(s[2][i]=='P')a[2].push_back(i);
for(int i=0;s[3][i];++i)if(s[3][i]=='C')a[3].push_back(i);
b[0]=mrg(a[0],a[1],l[0],l[1]);
b[1]=mrg(a[2],a[3],l[2],l[3]);
if(!b[0].size()||!b[1].size()){
cout<<"-1\n";
return 0;
}
ll L[2]={lcm(l[0],l[1]),lcm(l[2],l[3])};
ll x,y;
ll d=exgcd(L[0],L[1],x,y);
for(int i=0;i<L[1];i+=d){
ll c=i/d;
k.push_back({(c*x%(L[1]/d)+L[1]/d)%(L[1]/d),i});
}
sort(k.begin(),k.end());
for(ll x:b[0])f[L[0]-x-1]=1;
for(ll x:b[1])g[x]=1;
NTT::multi(f,g,h,L[0]-1,L[1]-1);
ll sum=0;
for(int i=-(L[0]-1);i<L[1];++i)if(!(i%d)){
sum+=h[L[0]-1+i];
cnt[(i%L[1]+L[1])%L[1]]+=h[L[0]-1+i];
}
if(!sum){
cout<<"-1\n";
return 0;
}
ll T=lcm(L[0],L[1]);
ll ans=T*(n/sum);
n%=sum;
for(auto&[k1,i]:k){
if(n>cnt[i])n-=cnt[i];
else{
for(ll x:b[0]){
if(g[(x+i)%L[1]])--n;
if(n<0){
cout<<ans+x+k1*L[0]+1<<'\n';
return 0;
}
}
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 17896kb
input:
3 TTPC TLE P AC
output:
34
result:
ok "34"
Test #2:
score: 0
Accepted
time: 0ms
memory: 17892kb
input:
670055 TF OITFKONTO GFPPNPWTZP CCZFB
output:
-1
result:
ok "-1"
Test #3:
score: 0
Accepted
time: 3ms
memory: 18044kb
input:
910359 TOKYO TECH PROGRAMMING CONTEST
output:
1401951321
result:
ok "1401951321"
Test #4:
score: 0
Accepted
time: 19ms
memory: 23812kb
input:
518530 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
518530
result:
ok "518530"
Test #5:
score: 0
Accepted
time: 122ms
memory: 44340kb
input:
252288 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
252288
result:
ok "252288"
Test #6:
score: 0
Accepted
time: 116ms
memory: 39556kb
input:
1000000 TTJLTTPNTTQNTTBJTTHZTTJSTTRUTTVWTTJXTTMGTTZHTTRWTTNHTTDWTTMGTTIDTTSYTTPPTTGQTTXYTTOETTYMTTZATTAOTTJNTTHHTTYLTTJBTTLLTTNNTTCITTCBTTDOTTNGTTPZTTUETTFHTTODTTCETTKXTTGUTTZSTTECTTFSTTHOTTESTTNQTTHJTTDPTTFKTTCMTTNMTTGRTTYPTTKQTTYCTTUITTYCTTWWTTZDTTCPTTRSTTLFTTPKTTEXTTUPTTXWTTDATTVUTTLCTTEGTTOLTTRI...
output:
-1
result:
ok "-1"
Test #7:
score: 0
Accepted
time: 116ms
memory: 40436kb
input:
359869 TTXTTTYTTTITTTHTTTRTTTOTTTETTTKTTTZTTTYTTTBTTTUTTTBTTTJTTTDTTTYTTTJTTTKTTTYTTTLTTTATTTLTTTITTTHTTTUTTTMTTTDTTTITTTPTTTITTTCTTTCTTTRTTTZTTTVTTTETTTGTTTNTTTUTTTGTTTYTTTJTTTKTTTQTTTSTTTPTTTWTTTPTTTZTTTETTTJTTTVTTTGTTTUTTTBTTTCTTTCTTTXTTTWTTTETTTFTTTGTTTDTTTATTTCTTTITTTWTTTWTTTITTTSTTTRTTTYTTTETT...
output:
-1
result:
ok "-1"
Test #8:
score: 0
Accepted
time: 113ms
memory: 39400kb
input:
856943 QNTJMTFRTNDTXOTJRTNNTCXTZNTQMTSBTMRTDMTMOTEATOXTHWTOJTQQTLITKRTNSTNITSMTRVTLLTKBTSATYVTHXTEZTRXTPNTEQTQDTVZTMOTJVTESTRQTBBTAXTMNTUBTULTFPTXQTIBTCMTXXTMZTOWTYVTPVTDSTMWTZDTGQTVMTRFTKDTQITKSTCQTOPTSRTJWTFCTEFTCKTISTELTWGTHOTODTQHTLETRCTSHTJITQGTSUTFDTFZTFYTBJTKNTMHTHWTOZTARTZGTQETRITMSTXVTZATKJ...
output:
-1
result:
ok "-1"
Test #9:
score: 0
Accepted
time: 15ms
memory: 7324kb
input:
12 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
-1
result:
ok "-1"
Test #10:
score: 0
Accepted
time: 102ms
memory: 40544kb
input:
1000000 WTTTNTTTLTTTZTTTWTTTKTTTDTTTATTTNTTTMTTTZTTTHTTTVTTTVTTTITTTSTTTNTTTSTTTPTTTVTTTWTTTJTTTRTTTQTTTFTTTQTTTMTTTMTTTYTTTWTTTLTTTMTTTNTTTCTTTWTTTSTTTVTTTDTTTUTTTLTTTCTTTCTTTZTTTQTTTQTTTWTTTDTTTQTTTZTTTUTTTQTTTITTTYTTTATTTATTTGTTTITTTWTTTYTTTYTTTFTTTHTTTPTTTDTTTWTTTRTTTLTTTNTTTFTTTNTTTNTTTCTTTBTTT...
output:
-1
result:
ok "-1"
Test #11:
score: 0
Accepted
time: 110ms
memory: 37244kb
input:
506084 TPTGTATITNTJTPTBTZTDTRTVTJTVTSTFTWTNTATYTKTJTCTBTPTPTJTSTQTGTPTKTYTBTMTXTVTMTUTFTPTRTYTVTFTATCTLTITVTUTNTATCTJTYTOTOTMTKTBTMTMTKTQTWTBTHTITATUTYTNTETRTYTWTDTLTCTPTGTKTMTETGTCTWTMTNTKTMTATDTQTWTWTPTMTRTYTQTMTJTCTGTXTDTUTSTBTYTFTKTGTYTHTNTOTOTXTQTITITSTGTUTMTNTPTETJTDTJTRTBTKTXTCTSTRTZTSTWTUTJT...
output:
-1
result:
ok "-1"
Test #12:
score: 0
Accepted
time: 108ms
memory: 39484kb
input:
95378 JTTGTTYTTMTTFTTSTTUTTBTTNTTSTTVTTKTTYTTUTTITTFTTYTTKTTSTTSTTATTMTTQTTMTTLTTRTTWTTQTTLTTWTTPTTYTTGTTPTTNTTUTTRTTKTTWTTHTTVTTGTTMTTQTTUTTXTTCTTZTTUTTBTTDTTPTTJTTETTZTTNTTOTTKTTITTOTTGTTSTTQTTVTTZTTATTBTTATTOTTYTTZTTZTTZTTDTTPTTHTTMTTDTTLTTNTTNTTITTETTRTTYTTOTTWTTZTTGTTGTTRTTXTTKTTGTTVTTDTTSTTWTT...
output:
27097032
result:
ok "27097032"
Test #13:
score: 0
Accepted
time: 106ms
memory: 40964kb
input:
12 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
10636
result:
ok "10636"
Test #14:
score: 0
Accepted
time: 106ms
memory: 40672kb
input:
1000000 LTTTWTTTLTTTWTTTITTTQTTTWTTTKTTTSTTTGTTTLTTTHTTTXTTTFTTTYTTTPTTTBTTTFTTTYTTTBTTTZTTTYTTTHTTTNTTTVTTTKTTTMTTTITTTQTTTYTTTYTTTZTTTGTTTBTTTLTTTMTTTJTTTYTTTVTTTITTTYTTTRTTTCTTTHTTTRTTTUTTTWTTTQTTTITTTVTTTWTTTMTTTRTTTFTTTITTTYTTTETTTFTTTHTTTOTTTYTTTOTTTXTTTFTTTLTTTRTTTFTTTGTTTETTTBTTTVTTTETTTWTTT...
output:
907999396
result:
ok "907999396"
Test #15:
score: 0
Accepted
time: 109ms
memory: 39944kb
input:
713716 BTTCTTOTTZTTWTTOTTHTTITTITTITTWTTGTTFTTJTTMTTWTTRTTGTTFTTLTTJTTDTTWTTITTRTTMTTQTTDTTJTTWTTHTTKTTRTTQTTSTTETTKTTYTTRTTSTTGTTQTTYTTOTTCTTLTTSTTOTTETTUTTRTTETTLTTQTTYTTYTTITTUTTXTTZTTXTTJTTQTTWTTWTTMTTRTTATTNTTSTTJTTKTTGTTHTTVTTSTTRTTXTTMTTUTTNTTPTTQTTHTTJTTHTTETTQTTGTTGTTATTITTATTBTTQTTWTTHTTWT...
output:
563121569
result:
ok "563121569"
Test #16:
score: 0
Accepted
time: 120ms
memory: 37904kb
input:
11522 TXTTTHTTTVTTTOTTTFTTTZTTTKTTTZTTTJTTTDTTTPTTTRTTTHTTTOTTTXTTTCTTTWTTTNTTTDTTTSTTTWTTTCTTTHTTTXTTTFTTTSTTTOTTTHTTTCTTTWTTTUTTTXTTTSTTTZTTTXTTTLTTTETTTKTTTLTTTXTTTLTTTVTTTATTTLTTTHTTTDTTTITTTQTTTLTTTKTTTETTTATTTHTTTYTTTOTTTDTTTSTTTCTTTVTTTRTTTITTTITTTMTTTPTTTNTTTJTTTXTTTKTTTXTTTGTTTCTTTUTTTCTTTW...
output:
11152921
result:
ok "11152921"
Test #17:
score: 0
Accepted
time: 101ms
memory: 38232kb
input:
1000000 YHTTKJTTFNTTMITTNWTTOETTWJTTCFTTIRTTVJTTJMTTHOTTBITTLXTTRLTTVLTTOFTTMYTTOGTTAYTTVLTTCRTTENTTLKTTKETTXPTTSFTTCZTTGLTTJZTTGFTTOYTTSFTTLHTTNMTTANTTSGTTKKTTXETTABTTSBTTLLTTQOTTNDTTWATTERTTAUTTMWTTISTTASTTZJTTPXTTONTTVGTTEATTVBTTXGTTSITTPNTTLITTLQTTHVTTKOTTQGTTVLTTDQTTLHTTJETTWFTTDFTTIQTTIETTKHTT...
output:
-1
result:
ok "-1"
Test #18:
score: 0
Accepted
time: 95ms
memory: 37792kb
input:
1000000 TTXZTTYMTTVYTTASTTUPTTABTTLRTTEPTTQPTTMKTTCOTTPKTTPGTTSITTDRTTQSTTCPTTXWTTXBTTJDTTZNTTIPTTIOTTKJTTQITTEJTTJRTTAQTTIBTTAETTUOTTUETTDRTTNFTTPZTTYHTTMZTTQDTTCDTTVDTTHNTTXKTTUPTTFPTTYFTTIUTTUBTTJATTYFTTJWTTGUTTPXTTIPTTHSTTVATTHWTTWZTTMSTTJRTTYWTTSRTTUPTTDQTTKJTTIUTTVBTTNOTTBGTTINTTAMTTRNTTAXTTDW...
output:
-1
result:
ok "-1"
Test #19:
score: 0
Accepted
time: 100ms
memory: 38552kb
input:
367325 TSITTGUTTPJTTVDTTSSTTIJTTZATTKGTTPATTCKTTBWTTYKTTRUTTMOTTUQTTEDTTFLTTYOTTRITTYVTTGXTTVJTTWPTTVDTTAFTTSOTTJZTTDKTTBUTTSPTTFSTTHXTTKDTTVJTTCUTTALTTRHTTAJTTZHTTZDTTAOTTJVTTLKTTSXTTFITTDPTTGSTTXRTTEITTOQTTEPTTVCTTSITTJUTTPXTTZWTTPKTTUZTTLWTTYBTTFETTJYTTLDTTGSTTIITTKFTTKHTTUGTTVPTTXNTTFCTTLZTTYXTT...
output:
-1
result:
ok "-1"
Test #20:
score: 0
Accepted
time: 97ms
memory: 41108kb
input:
1000000 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
-1
result:
ok "-1"
Test #21:
score: 0
Accepted
time: 107ms
memory: 38132kb
input:
1000000 NTTNWTTJFTTLMTTSATTRWTTEXTTBETTPBTTEBTTXPTTUDTTWVTTWMTTWZTTCATTSBTTKBTTEKTTNHTTPBTTCATTVITTPJTTCYTTAPTTVLTTDHTTVQTTJUTTCFTTLXTTODTTFMTTXRTTRLTTNPTTVNTTYMTTOXTTDUTTVZTTSDTTMPTTYCTTLKTTFATTCETTUFTTGDTTKVTTGYTTVATTYZTTQRTTWQTTMGTTFXTTLDTTXRTTGFTTPLTTQQTTOVTTEOTTJSTTXSTTQKTTRVTTWZTTKXTTRBTTRRTTM...
output:
-1
result:
ok "-1"
Test #22:
score: 0
Accepted
time: 118ms
memory: 37716kb
input:
1000000 DTTTATTTBTTTUTTTUTTTNTTTDTTTITTTATTTRTTTFTTTJTTTZTTTDTTTRTTTETTTWTTTCTTTHTTTFTTTBTTTJTTTUTTTWTTTJTTTCTTTETTTYTTTHTTTWTTTETTTWTTTCTTTZTTTWTTTYTTTKTTTRTTTLTTTVTTTETTTOTTTDTTTPTTTLTTTMTTTWTTTCTTTXTTTDTTTPTTTVTTTFTTTATTTKTTTWTTTOTTTUTTTPTTTZTTTMTTTETTTWTTTRTTTPTTTRTTTHTTTFTTTYTTTRTTTKTTTJTTTETTT...
output:
452272320
result:
ok "452272320"
Test #23:
score: 0
Accepted
time: 106ms
memory: 40768kb
input:
1000000 CTITITNTHTTTBTZTNTMTFTCTZTJTRTBTUTPTWTWTNTUTMTUTETITITATKTMTRTPTVTXTPTHTNTGTSTMTUTWTKTWTITBTCTHTFTWTDTHTWTBTSTNTNTCTGTVTVTVTMTVTITWTJTRTYTETMTKTFTGTPTXTHTGTXTVTPTHTKTSTMTUTMTLTCTDTHTGTUTVTPTYTQTOTBTMTZTZTWTOTFTGTATBTFTQTNTPTGTLTYTKTPTCTFTATSTDTQTBTXTATVTRTGTITSTITDTKTPTNTKTKTBTATWTKTRTBTMTDT...
output:
975999035
result:
ok "975999035"
Test #24:
score: 0
Accepted
time: 199ms
memory: 64548kb
input:
11 WHLKKWTICHLBXNJKGGFGQLTLEHQUIYKLQZVWFFAVIDVCVJHUSJTYQTIJECJNQCLEJNZPKMPVBPKZHENYFXCSXZEUVJAFLMWIZPDWQDNRPBIGBTMNQKQOGJFEQYDHQYIBZXHBMWTJZJJWYWCQLEDVCUVCDMPEWOXGRADJQGRANTLNMTMHALLKTZYLFZPOPTOGKSTJBGJEGKBONVGJUSQDPBTECDEDGHAZCZOMZBMXVVTNMLPPLBVHLZXASGFRAIBAULIYDEHASZNGQDUBZCRTZYIXBDYWAGOIGCOAAPPON...
output:
6385324
result:
ok "6385324"
Test #25:
score: 0
Accepted
time: 479ms
memory: 105724kb
input:
14 UCBNFDDWTZCYVRYRQCEWBIVBQADDGNHJDJIPZMHCDWLAJDEJXIJIQTUOSNEUONNQIMOCRLSQXBPHDPQYBJLRQMANSCKNMCORGLIGAVBZQWQJKZFYDARHAZWYQOWYBKTWYESJAXNWDEEITRMCAPWAVVQQCCKQBSIPEGYZQXHYLWFOIYQBFESGUABSXJTOLACYNAUGFXJIBICEDPFLCUGQPDVZVGXRBKSHIDMFGEAAAPVCEBZJIZJQJTXQEPLZXFUQYWWPBQIDQDAXCGSBJNMBVOQTPWMTVVIZZTZZNOLBN...
output:
3768074
result:
ok "3768074"
Test #26:
score: 0
Accepted
time: 208ms
memory: 63996kb
input:
621991 PHSWLBLHWDNEUDLSMTKUPSYGZVVTXZVDFLIJERLKFTKBCPATGFTPXCYHAHBCPCFDBHHJMGDDIHSCNHNJMDPGMXXBSVCQMWALQNVOVWESQDBUTDPUMOUFTIHPQPYFUSWARGPFZFVUNNRUBOTHERYQVKCODQOMKXOAKSQEOVEXDNCHYNIVKEJJVJSZSSCQKXDWVMSWEXXKOYMQZSGCLTFQIRZMVVXXPJSGDZWRZYIJOLGGZCAHKUGSMEOHLJZKYZGIEHQDAIGBAPTJQIXUCMZDTDPAWACGFJWUWPRVS...
output:
285656877012
result:
ok "285656877012"
Test #27:
score: 0
Accepted
time: 465ms
memory: 109656kb
input:
681065 BPEIWKXAPGASDFYOVYWFZIFZJCTSZOHAXWADMHJQZAVYZDMYUEBGJMPIFDQIHSWKJZKXDJGLUMRGBSVFLDRWGSDWDXBBNMQFDJLVGSEHCFWYINVJGCGIOXIFVVQWYPVHSMOTSCJLYFNHBWNZHHYBGZKRZBPAYJFRZOICJOOBOVXGEIUXMGEUVYSFUPITQGHGFUPHCPJLBRRXUBLQRQVDSFHCYODJXQJZJKDZWEHLQRJIONJGGDJHXJUTJSXYKXHCAXRLXVRQZNXNZWMUCVXQLUPCIILGAXCDZMQHV...
output:
640624135227
result:
ok "640624135227"
Test #28:
score: 0
Accepted
time: 236ms
memory: 65300kb
input:
36576 IRMNJPGAQZMFDZACMEVLGQSDJLXFAZDQRXSIDMSYFRDHZVQRDZBVXMMMGAPYFJBSHVDQVASDYGLCWKADPAEFHBAXIZWXSMNJYEKSKKNAKESFUQEDOLDZYOIPVSEXKVJPHMZGXOYLWDNJBPRIISSWDYPGICCCERHMHCRYNZFPMYXXUPMAWPUIVGKHCJIQBQPPEDZDXZNUFQOCKZRSRAKCMVMSCBVFAJXUAVFZVUFERGHDXFMHUBOLXCJCNSHIEHNBWJYKOEUTXMKBPGQKWQZRLXYDFTCWLBBIYBFTYS...
output:
1631600024900756
result:
ok "1631600024900756"
Test #29:
score: 0
Accepted
time: 233ms
memory: 66984kb
input:
870492 ADNCVEKYFEDDSBIFJBFNAIHWGFWXLWYGROVNMWHJPTPCHMMFBYAXZFOUBOOCXQLEHLQCHJVJVGSMNPFNHHWOJBMDEASWBBALXBSFXXFVLIBEUMXGSNSKLEKOQGYHRLENMRRKNIURCFVQSXLNJJJNAYYSPFCILXCGCRFCBZDQAHKACQNFDSNKBFYDROLJPDKWZVLAJCUVIFXEHVGKXXKDKOOXFHKSARJMVWXGUYWUCDZOXNFHMYPJOECWNOXQBBWDOSSYUMCMZWSNSXMCBXNZHISVKLDJXABDKOVQH...
output:
2249019642670992
result:
ok "2249019642670992"
Test #30:
score: 0
Accepted
time: 229ms
memory: 65932kb
input:
699084 DMSSXMPXNYSUSGIHNSJDADZYKFGERGBHUVBJQLNZPBQSVFKZNAEGQJCGBAQVBMCFOWAZEJOEPIYSAKEEIDKVBMHVZGUWIGWGHDWMRCXDVAAWHSVMBCVCFLBMMKEJMMUSGWKXZXLKRQVDLUGLKBXCKOQLUOAOXMKUCIMNYVITJYFQPYCAISGUXPPXJJXBWRHCUQSBOXFMZDHUOMIRODDJVQIINHHSDKLDZLZOAOQXVJGCIYWVFLNLRQYLKSDZJVQNNRILUZISWYYKYGESNBPIWDRQKAFVZMUJZKJAC...
output:
2238903359576856
result:
ok "2238903359576856"
Test #31:
score: 0
Accepted
time: 455ms
memory: 112328kb
input:
1 YBBQHUMUHPCOXASQLWBRXUPEORMGCOFIVNDFSNGFJRWRYPACZSVJGKMMLJRUVOVXDVPAFCFXOAXMDGNPCXLZCHGBFCVYYOBEEOIFSNGFRINXEXUGSWOIZUJFFBVOEXPRSOIONPWYRQDKAHUKOVUJKXZCSLVIBWISZLDMXXICKVSEUALMNDLHNHMFBGXSSXJPBEPRBLJXBUIUGEZGUEHNEQAMENIDVJJYHZCPRFUKLRYFGPVYRDIQSEKKEZFZGQUFPSHQLZFMQVQXOMHDRXFMFOFVLWBMNJPIAFYWMFSQDQ...
output:
42737103431
result:
ok "42737103431"
Test #32:
score: 0
Accepted
time: 226ms
memory: 63192kb
input:
1000000 MJIRPODODXHXEGOQKDVQXFKONESHJFWAKFOURAPYCPHRCLUDISEFAOAWWMINVAMUFUWJEWCWYZJDPAVQJPULSSKPNLFHXLNXCYDYCJAYBIHSEHVCWBFXPFQVVRDGMCLPQQSRXDMEOGXPYNXHFIXDVXZRCYOEHUVSEIURMHSPILBWKCZFEYVGZGJAPUMIJIUGQJHESQMLXYKPHHQNGYMVOLJUGLLIWBNPYJMKVLUSLNFWAHFMENNLIDDELSWTKPWRSDXQDSDPAPQSWQLKXODALELSLZSELOQLXKEW...
output:
3392859102435868
result:
ok "3392859102435868"
Test #33:
score: 0
Accepted
time: 238ms
memory: 65676kb
input:
350208 TLTHTUTTTIECTJTTTTNTTTTDTZTHJXSZTVTTTATTJHTKTVDTTXTTTTTTBATTTTTTXTTKTTTTKTTDTTTTNTLYXTTTTTTTFJTTVTTTCTOTZNWKTRPTKTEKETTTTVRTVWCUTTTKDZWVPVMMTTTISJTTTQTTTETTTTTMTTTTRTTITTTLTTMVTTMTTKQTTTWTTTBTWTIGTCTZTTTTTTNVTYUTTTTTTIOVTTHITTSTNZTTTOTTRHTTTTDHTTTUVPWTTTTTUTTTHMLFWNTQTTTFHTPTTRFITNDFTJNCKESTI...
output:
1248723
result:
ok "1248723"
Test #34:
score: 0
Accepted
time: 594ms
memory: 131488kb
input:
343585 TRTTTTTRTETTTTQTTTTAOTTTTWTTSTHTXSTLTTSITTTDTTTHTGTTTTTTTTTBTTTTTTCTVTTTTNTTTZTTTTTNTTTUTZTMTVJTTFTDTTTTTTTYLTTTTNXTTTETMTTTTTOTTTTTTTTBTPTTTTXVWTTLTITINTTTTTZTTTATTTPUTTTTTTTOTTTTTTTTTSHTLTTTTTTTTTTTTTTTTTPXTTTTYFTTAYTPZETTTFTHTAOTTTTTTTTTTTRTTOTTTTTKTTTTTTTTATTTTXTTSTTTTTTTTTTOTTTRTTTTTLTTL...
output:
1468088
result:
ok "1468088"
Test #35:
score: 0
Accepted
time: 276ms
memory: 76168kb
input:
1 TTTTTTTTTTTTTTTTTTTTTTTTTTTQTTTTSTTTTTTOTTTTTTTTTTTTTTUTTITBTTTTTTTSTTTTTTGTTTTTTQTTTTTTTTTTTTTTTTITTTTTTTTTTTTTTRTTTTTTTTTTTFTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTMTTTTTTTTTTTMTTYTTTTTSTETTTTTTTTTSTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTETTTKTTTTTTTTTTTTSTTTTTTTOTTTTTTTT...
output:
1
result:
ok "1"
Test #36:
score: 0
Accepted
time: 304ms
memory: 80400kb
input:
1000000 IHTTXXQVDVKETTPPWTTLLTYATTBCETCLTSEIXTTGTTJTTXBTXTTVTTTTIFYTASPDBTWVHTMVBTLTHTTQWTTTZAIATTDTTTTHGJTSTEZVTYPTTXTTTOLWTEFTEIHUATPTTQWTBVYTTCTVXZTDZTTTZZTMULPUSATTTITTEWFXTZNPTETDTLTUTNTDCTPLITDTYMWCTJTHZTTFTHJNATMBSDJTQTZTYDWFTTQAJTOKTTQKTTCUVTTAVXXUTRTULOTTTUUUZMRMITTTXHTTGTTTOBUTKTMTBPHTTTTT...
output:
4223102
result:
ok "4223102"
Test #37:
score: 0
Accepted
time: 243ms
memory: 67704kb
input:
345046 YHNYBBTUCRWJTYITEQDYYTEHAGBWBETO KT JNFETZVTCUHLGMPNGVMWZZFIXNFGUVSSEBSKMZUJSCFVCDTWPCPBPSPYTKLDOAOLRJJLESLGLOVQLDJMHYSQACKIMABZVTMLCPCAQEXDTJFBLNYCNJWJDDSAXEEICBXVYQGYBPXVNFCHIIXKUMMQXOEMNDYBGNGEJJCQIHHLYFUIZNJHUGSRKVXFRRTEYTCLVWTOSBNFBLZPSSPUFGMMLVYTADJGUGJYGKQCHOCNIZCPDNFLFVNBAHTGJAFKGPJLL...
output:
3140057680
result:
ok "3140057680"
Test #38:
score: 0
Accepted
time: 97ms
memory: 35428kb
input:
990105 T T FTBLKZUGHSNFTKEUEFRULGLILYCTYPKXZJGPQTUUYNZEOVXWTHZDKUMINCMNMZVQDLVVFLKBBFAWUQRFJLHKBRZFNKDOBNVKWQEKCBFXCUJGEGTUPKJHGQEDFEVXTNVUTJEMIIYWJMHVXDABJPUAXZLHXFRMKFMOFUPKTNELPOGHIABOSMCKQPQHEWKCKGGXTAXMAGXSCKXBMHSVMORIDRLLXWCUCYTUIROUNUNBIDNAXBQSDYWNVTYKRPWEJDWJRIIACNIUPXJUKAMPAVULCAKXGVEAXYTDT...
output:
866652802
result:
ok "866652802"
Test #39:
score: 0
Accepted
time: 204ms
memory: 57460kb
input:
749386 DUGGXTKUUHOZRLDPEVBNGEZUQPUDQFGHYQNMPMJRMPSFVFLECMGXNFDPQZIQCIUDUBNVIRAMTDMDDQRMJZEMKVEDQWTJIUUQOMHGEQETZUWIIOXPRUMAYLEGQDNRATLWXLYSYWMNOCBPITAKFYBMXDPOSHNZIEOWXCWDUNBSPNVONUBUPANOITVOIRJNEXUIWWLJJNJAMIMHLFMVHISWXDXNAYGTTKXRNEYTLKBKDULTHDBMSLTRHTAYRCGCCTPZEYHLYEWOFNQXOOIOGSHANWZGGEZJPVNJDFJVS...
output:
5798101706
result:
ok "5798101706"
Test #40:
score: 0
Accepted
time: 104ms
memory: 35784kb
input:
866202 UXTLRNTHESMXDHIJJQMRBZTFUVPADFGJWOEYLEDDHYCBJXXCHWTUWBDSKUDMFBHOQEFTPECMBFTSJKAPNTJLWSJCTHDKPLEKAZGZBXFZBNURENZXPJDSGMCTLAJNWKPZRWNDNJUAEOBZLYWFUSDCEVVADQZMVZVMFWNBBMSGOTDHGVOPBFLEYIQEKHOMADATVMIKFJUSNUCMZKFTTLQDNGCFNXYVMHEEFQUVPCCGKPXBXDPUVHWPYVGMOBAQDANKOWKTDATEPPINMNRQLRWPIJPHMJEMRINZZDDQI...
output:
23920713675
result:
ok "23920713675"
Test #41:
score: 0
Accepted
time: 1ms
memory: 5556kb
input:
610175 LMSBGVAMNSLAUVFWKDZOQFMBUDYXLKPRYOKNBWNPNNGNOMHAJZKXKIURGJQYZFOAKUAAMOENJFADLHXRLAXCXZEMUFRJAFDOGNIYZIQLPFKJGRJZUHSWECQRVACLYXDBRZAJRANHCFCRWPXRVNJSYCXBBMSXFSIRSBNBVGNAQCPQNLZMUIHYKJYWCDHHKANZUXWWCAVPSVSLEJSCCUAUEORRMADXIAIXUSLEUQRUDGHXIPDVPEZRADAXXVENMHGSOXPKKZGKNNCVSKGCKSZLZWVJIHMLAZXFVRUQH...
output:
-1
result:
ok "-1"
Test #42:
score: 0
Accepted
time: 1ms
memory: 5668kb
input:
756402 XSCBCBAPCCEYMGHJSUVDLMSSKUWBEQWFBWGEORUIKDAEKLGMAZRZJSARWQJNJGADAUVAJCMJJLHUWUCRDXSLBIGARBXRBONWZYPFXLNLUCLIIJMWVLAVXPBSJHCBXAPHGGIQDSGKOXJCALHCALARIKDNYPSHCKIESGSMULRBRJSAMFPOYVZOPNAYPCGBHVVWDDMNOUXWAFDVXORXMAYPYZAYUCDFLGKJERDJZZZDAVBDQPBOXEWUBNECAPJJXWKHHRIQVQRJVQOPJDAUYLNLPZDMYKRFGFLIMGYNO...
output:
-1
result:
ok "-1"
Test #43:
score: 0
Accepted
time: 1ms
memory: 5960kb
input:
919744 USJEGOJVYQVJIGPJCGEIMWJIPVBISYGBFEQXUFEIICJUNOLOKGNFJODMSRFRRKJXLJWQBPFFVJIHAWXZEWUJDXUHYEJHODCQFHUHZGIRKBJDPHDZARJZZZXULFVUJCWAKDEHWQIZDGKXEWIOIXXDRSAYJPVFVEDSFDVGHNWYRFLWHBWDDYBCRYDWWWQGCPOXLCQEUYXGNLOMXWPYQAZCMFGDZYZNKUKGWCMPDGZKQDQPNBOLRDPQUWMFOCNRRLXUDESUCDHQSPLXCGXHRXVFWQCPCLXDPJDIXQASG...
output:
-1
result:
ok "-1"
Test #44:
score: 0
Accepted
time: 81ms
memory: 36292kb
input:
178094 HZWHPASQGCMRKYNSKGRXRJSSNSOLLIGZEENWSGMGLOTSKUELOFMOEHRAOSOOMPTEYRNLCOKTZGMOORBSCTKEPBRSMMVCSIYDCLHYRNRBMNIZWAPEBXANQGFDCIUWYXXMSOTGLBYBUWPOZJMSRSBVYMUKJECRZOZPSILNUOTXNISNQYCGQVYIEHNLLLKLEWONDQLRTGQNTFIPEJNYTKFCOZNCCQBGXTABPJWFJGGUUFRJKDMUBXQWWIMOZMNMMURSTVIKZFNSTJFUJVUVGJVOWCZDNJQQIDCDZXFOY...
output:
101851007373
result:
ok "101851007373"
Test #45:
score: 0
Accepted
time: 42ms
memory: 26392kb
input:
39543 AQPXLJNTTQLCKBXEYORIHKWPLZLRDSIOGTQLDQRLOZKCNFOAJSVRSWQZRJPKLJPUNGYTUWNRXBMDONTILKYKYLGNKGBFTTOKQWYDDULORMCAEEIDPJLBHKHLULTTRQLOPONMWUFZWSRFHHHNVKUVMRNALCTKSJUPC SLUDMGAUPMFSUYJLEATOTPVLJIRRVFXXUVPKYUINMHEUXHLHCSAAFCJUSMPLUOABQUCZPUIDIDDSCDDOGALBXTVHZONATVYSYOIQWAIZFGPBLCBUAMAXTRQQGGMJAGETSVBM...
output:
10428475413
result:
ok "10428475413"
Test #46:
score: 0
Accepted
time: 99ms
memory: 33960kb
input:
513749 FTFAAVVEXZFCJHJLRTXHZBMFWRZZJFGCAFKJCRLJGXNCGNWTHEIMSNFDNREGTRKBYPBQFOGHIIXXQHALXTQFKQUVQJDUSNQFEUENDGMMHKTRFHQTYCAOWJWVNCVYIBKHXMAGDXXIOARCQZZFMRKPRYYPOVFSPCRCBNEPIVSFLMCRAFFXTAVBLQDFXWCFIFSMPOHRZPVAWZFXKSMQNXDIDCVBKKATUEJFUIENPGRCLJMBUJADEUAYAZPACDTKUUMUKMXKEAKJMFDBQWMKZSDEPZIPWRKKOJQONPKCZ...
output:
297904535175
result:
ok "297904535175"
Test #47:
score: 0
Accepted
time: 105ms
memory: 36216kb
input:
323568 HPCBEXJKHBICZDFYOPUZNIQSKEYEYGWNWNOUBKXZMPPYMIGWASAESQDCQELHRDQZHDNVBJVAOPSRCBQIYPLSQJXMFZXSYESFHXPXIABQLIKDZZKTFXEOIFWLJXHPKXUJGGUQLMRAOBQDQRKHQFMOUAVFBCIDFHCMRREKMXDJRYBFJNDDQCZAJRLVMZFEMFVYKOSIWAXUHSKEHKONJGSOUBLAAEAMBOGYVIDHBTPDPGJKWMBNNOEUCPWLEBHSHLISZMLSNKQQPIMJKMWIGINMCXBNJHWIJKFQAJPYQ...
output:
195139073323688
result:
ok "195139073323688"
Test #48:
score: 0
Accepted
time: 1ms
memory: 5884kb
input:
999097 JMLDZBUFHJCMCBZYSICXVXSAMWHRXBKGLRINYIVJFMREUNGWXGJHXJCRIBDPCCYBPSNUAGERMXJHRVPLHVGFGBZBXEDZZXYVXNQRLDNOLJMHALPKLOWTZVTYVDAVSJXGDAQNSGHHMNEAXBKBVCVUMAPUUJKLUQIYVMIZDGOCWOAFXNRQNSJNCHLHMJGBQBFCQMHFNKUABXPNEINEZMWCG XKZOCCLIDPCRBKZUZVWNYHEKNEOUEJMSRFYCLLKPBPSSCXXZIXQQQOGYVDYXJOGPPIROKXONZLBKUJR...
output:
-1
result:
ok "-1"
Test #49:
score: 0
Accepted
time: 183ms
memory: 57504kb
input:
655651 CIXDKABYGNOFBFJPZMQHEVRRUGCIVXAADZKVXLGXRKWSOKESCXMGJYRHAVKRHGNWRQIUWRHHQMYKULBFOEVUDSIGGNVABJFXWQOTDUSRDEYQZOHNPKJEZCIOJIBLSYKOXCSYRBPNKWZZBIRZLRBVKJXFXQUQRPCQKGMOKOBTYYQWKJILUCZQLIYLLWDOLRZEQUEDYHQLXSXCBWRFMZHPUWPRMSHIROBBEVXRSFCWOUULSZWRGHJKSKWMIISEIGYMXQHKKBCKGIVWJOHWQPVUFGNJQUYJXHCKYSYCW...
output:
2634424714338390
result:
ok "2634424714338390"
Test #50:
score: 0
Accepted
time: 1ms
memory: 5940kb
input:
622657 BOEINRYGECRHNYPWZVYUZBIHUFQESGGOBLRUGOIDJEJZFSANFJRXLCKZPVBJCARZEZBXVEFSBPIJSJWXEMWDXOXPPHDLVQKKJDDKCSKNNHFASMSBOHOMABBBNZKSYIASGIUEWLMLVOXDFOFSIVOGWFYFMDEXJANBURYSWVBXZHRIYQLVPDMNKJQKNJRXCSMSOOIXELGDLKHSPVVLDHJIZKYAQRXHVJBDUNBUCIPPBSXXZLIVJRLSIPFGRYJOSEXQJIAYWAAJDPQISAVYBZFKAPWJFBGJXVQVVIMSW...
output:
-1
result:
ok "-1"
Test #51:
score: 0
Accepted
time: 0ms
memory: 18320kb
input:
1000000 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTTTTTTTTT PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
1000000
result:
ok "1000000"
Test #52:
score: 0
Accepted
time: 0ms
memory: 11880kb
input:
1000000 GTTTQTTTNTTTXTTTQTTTLTTTZTTTBTTTKTTTBTTTDTTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT PERYPSRBPGFUPTIAPBWNPVLLPJCYPGTHPSHL CCCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
-1
result:
ok "-1"
Test #53:
score: 0
Accepted
time: 0ms
memory: 18204kb
input:
929626 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT ATILTXVTOBTSXTNVTHUTUSTCWTBGTKSTWMTOJTVPTS PWPPAPPKPPQPPVP CCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
-1
result:
ok "-1"
Test #54:
score: 0
Accepted
time: 2ms
memory: 9788kb
input:
1000000 TTTTTTTTTTTTTTTTTTTT MTTMOTTULTTOITTWJTTAOTTGMTTBXTTB PFUPPKTPPOWPPLZPPNOPPKGPPLIPPGBPPQGP CCCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
-1
result:
ok "-1"
Test #55:
score: 0
Accepted
time: 3ms
memory: 17976kb
input:
5633 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TULTWITPZTXJTXQTGFTPDTHVTKB XPPIPPTPPVPPOPPIPPAPPLPPPPPTPPWPPMPPEPPKPPHPP CCCCCCCCCCCCCCCCCCCCC
output:
253465
result:
ok "253465"
Test #56:
score: 0
Accepted
time: 0ms
memory: 17952kb
input:
1000000 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TQYFTPAZTCWHTSHRTWKVTTBCTVTJTNVU PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP BCCCXCCCXCCCWCCCPCCC
output:
15999995
result:
ok "15999995"
Test #57:
score: 0
Accepted
time: 0ms
memory: 12044kb
input:
1000000 ZBXHCHSZMLVPLQGGTJDROEZBFDEQ DKDOKMUWXYLODPABTHGCFRYICACVVDMICSOHBUBPHUWOI CIBJMYEHQHLLWFYSPJJCGTDAYNNWUAISUYUZEDOGRCD ANOJKQAXPJTNDGSHCQSDSAFBXWDDKRVHEQROPZKZS
output:
2221377778637
result:
ok "2221377778637"
Test #58:
score: 0
Accepted
time: 2ms
memory: 12000kb
input:
1000000 WZENZHGEFMTHAZKSMODUCBNFDDWZCYVRYRQCEWBIV BQADDGNHJDJIPZMHCDWLAJDEJXIJIQUTSNEUONNQIMOCRLSQXB HDQYBJLRQMANSCKNMCORGLIGPVBZQWQ JKZFCDARHAZWYQOWY
output:
1080349150532
result:
ok "1080349150532"
Test #59:
score: 0
Accepted
time: 2ms
memory: 12284kb
input:
999931 YZQXHYLTFOIYQBFESGUABSXJOLACYNAUGFXJIBICE DPFLCUGQPDVZVGXRBKSHIDMFGEAAAPTCEBZJIZJQJXQEPLZXFU QYWWBQIDQDAXCGSBJNPBVOQTWMTVVIZZTZZNOLBNUVDGDBHAL SEAMROELTNSNJHCSUONPLHIWTILGSKZZSKZEBVS
output:
3917276603931
result:
ok "3917276603931"
Test #60:
score: 0
Accepted
time: 0ms
memory: 18032kb
input:
1000000 BIHBPVPHYTWZXITHWCEXISNZDNTCZEBTNHZFWIOAEPZCOBUNWL OLIBUOONULIOXSTJTQGSUQDIQEJFOTOTIDKIWZRAP ENGELUGMJLBACDRYPHEKPPVPXQIURFGOYOMUOVEKYLQUIMWF APRFKDFOUVYYOAAMCTYWCHFITGVIMCCEQUZDPJR
output:
13324982182
result:
ok "13324982182"
Test #61:
score: 0
Accepted
time: 0ms
memory: 16020kb
input:
757219 SWEXJTINTTWDVHGIRGRWKBXJLSEHPLHTHTDUDSR KEHMUTHUGBTTACTTG EEYLFRCHPVUCUPTNKCEIYJWCKRCFLJDPPBPXTIJI AIETPYGASHCOOXKHCCRPXCJFKDFIYXC
output:
996058294
result:
ok "996058294"
Test #62:
score: 0
Accepted
time: 1ms
memory: 7708kb
input:
629201 TT VTTTT PUTLPFRQRP C
output:
3146005
result:
ok "3146005"
Test #63:
score: 0
Accepted
time: 0ms
memory: 15896kb
input:
147204 T TTTTTTTTT PGFQGLP ZKLCQ
output:
2576064
result:
ok "2576064"
Test #64:
score: 0
Accepted
time: 1ms
memory: 7940kb
input:
805507 TTTTDCVT TTT PPPPPJNPP CZCPVKPCB
output:
3866419
result:
ok "3866419"
Test #65:
score: 0
Accepted
time: 0ms
memory: 16040kb
input:
524954 TPBTKTTGTZTYPTJTTZOTTSFGLTTLKTTTTTTTTTOJ TTTTTTTTTTTTTTVTTTTTTTTTLTPTTTTTTTTTTTTTTTBTTTTTT PAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP ZDOCSCCBCLWUCJCFCEMCANCKCCCSUCC
output:
2352475
result:
ok "2352475"
Test #66:
score: 0
Accepted
time: 2ms
memory: 5828kb
input:
127002 NCBTQETTQTLTTTTXT TTTTTTTTTTTTTTTTTTTTTTT PPGPPPPPPPPPPPPPPPPPPPPPGPPPP GICCBDGADCCTCCJXNCMMCJFCCGLRJXCZCZANYCCFSAXPWEFGC
output:
841691
result:
ok "841691"
Test #67:
score: 0
Accepted
time: 1ms
memory: 6140kb
input:
1000000 KTTFJIMTODIDGTDJDTPTKMDTTIPBUTTGWGSPRXNJUKT TTTTTUSTTTWTTTBTTTMCTTCTTTTVGDJTTWTYTTTTTTFPTT PSPPGWPPSPNAQPYPFUPPPEPPPPPXPRPXJPYPHPU ECCCACLCZCCCCWCAXCYUCGCAHVYJSFCMD
output:
26472458
result:
ok "26472458"
Test #68:
score: 0
Accepted
time: 0ms
memory: 9884kb
input:
936720 TTCTOGTB TTSVEZEWXWTQYRTOTNAZGZLNNOCXTHTTMQN BHOIRHPUNP OQGMCHXRC
output:
147533297
result:
ok "147533297"
Test #69:
score: 0
Accepted
time: 0ms
memory: 5652kb
input:
1000000 TTTDYJTTT FIZTUUTTTTTTVITTDNTTHOITXTTYTFTKTFTDTBHXTK PLPPPPPPPPPPVPPPPZPPP J
output:
-1
result:
ok "-1"
Extra Test:
score: 0
Extra Test Passed