QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#316915 | #8176. Next TTPC 3 | ucup-team008# | AC ✓ | 586ms | 18052kb | C++23 | 13.0kb | 2024-01-28 06:38:23 | 2024-01-28 06:38:23 |
Judging History
answer
// {{{ y0105w49 template 22M14
// hi mom
#ifndef NULL
#ifdef __GNUC__
#ifndef __clang__
// #include <bits/stdc++.h>
#include <bits/extc++.h>
#include <tr2/dynamic_bitset>
#define EXTS
#else
#ifdef ARST
#include <bits/clang++.h>
#else
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
// #include <cuchar>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif
#if __cplusplus >= 201703L
#include <any>
#include <charconv>
// #include <execution>
#include <filesystem>
#include <optional>
// #include <memory_resource>
#include <string_view>
#include <variant>
#endif
#if __cplusplus >= 202002L
#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#if __cpp_impl_coroutine
# include <coroutine>
#endif
#include <latch>
#include <numbers>
#include <ranges>
#include <span>
// #include <stop_token>
#include <semaphore>
// #include <source_location>
// #include <syncstream>
#include <version>
#endif
#if __cplusplus > 202002L
// #include <expected>
// #include <spanstream>
#if __has_include(<stacktrace>)
# include <stacktrace>
#endif
#include <stdatomic.h>
#endif
#endif
#endif
#else
#error "unsupported"
#endif
#endif
using namespace std;
#ifdef ARST
#define JO 1
#define OJ 0
#else
#define JO 0
#define OJ 1
#endif
#define STR(x) #x
#define GCCDIAG(s) _Pragma(STR(GCC diagnostic s)) static_assert(true)
#define Wsave GCCDIAG(push)
#define Wpop GCCDIAG(pop)
#define Wsupp(w) GCCDIAG(ignored "-W" w)
#define Wpush(w) Wsave; Wsupp(w)
#define typeof __typeof__
namespace gbd_ns {
template<typename C>
struct is_iterable {
template<class T> static long check(...);
template<class T> static char check(int,typename T::const_iterator = C().end());
enum {
value = sizeof(check<C>(0)) == sizeof(char),
neg_value = sizeof(check<C>(0)) != sizeof(char)
};
};
template<class T> struct _gbd3C;
template<class T> ostream &_gbd3(ostream &os,const T &x) { return _gbd3C<T>::call(os,x); }
template<> ostream &_gbd3(ostream &os,const string &x) { return os<<'"'<<x<<'"'; }
template<> ostream &_gbd3(ostream &os,char *const &x) { return os<<'"'<<x<<'"'; }
template<class T> ostream &_gbd3_5(ostream &os,const T &x) { return _gbd3(os,x); }
template<class A,class B>
ostream &_gbd4(ostream &os,const pair<A,B> &p) {
_gbd3(os<<'(',p.first);
_gbd3(os<<',',p.second);
return os<<')';
}
template<class T,size_t N> struct _gbd4_tupleC {
static void call(ostream &os,const T &t) {
_gbd4_tupleC<T,N-1>::call(os,t);
os<<','<<get<N-1>(t);
}
};
template<class T> struct _gbd4_tupleC<T,1> {
static void call(ostream &os,const T &t) {
os<<get<0>(t);
}
};
template<typename... Types>
ostream &_gbd4(ostream &os,const tuple<Types...> &t) {
os<<'(';
_gbd4_tupleC<tuple<Types...>,sizeof...(Types)>::call(os,t);
return os<<')';
}
template<>
ostream &_gbd4(ostream &os,const tuple<> &t) { (void)t; return os<<"()"; }
template<class T> ostream &_gbd4(ostream &os,const T &x) {
return os<<x;
}
template<class T> struct _gbd3C {
template<class U=T>
static ostream &call(ostream &os,enable_if_t<is_iterable<U>::value,const T> &V) {
os<<"{";
bool ff=0;
for(const auto &E:V) _gbd3_5<decltype(E)>(ff?os<<",":os,E), ff=1;
return os<<"}";
}
template<class U=T>
static ostream &call(ostream &os,enable_if_t<is_iterable<U>::neg_value,const T> &x) {
return _gbd4(os,x);
}
};
template<class T,typename... Args> ostream &_gbd2(ostream &os,bool,vector<string>::iterator nm,const T &x,Args&&... args);
ostream &_gbd2(ostream &os,bool,vector<string>::iterator) { return os; }
template<typename... Args>
ostream &_gbd2(ostream &os,bool fi,vector<string>::iterator nm,const char *x,Args&&... args) {
return _gbd2(os<<(fi?"":" ")<<x,0,nm+1,args...);
}
template<class T,typename... Args>
ostream &_gbd2(ostream &os,bool fi,vector<string>::iterator nm,const T &x,Args&&... args) {
return _gbd2(_gbd3<T>(os<<(fi?"":" ")<<*nm<<"=",x),0,nm+1,args...);
}
vector<string> split(string s) {
vector<string> Z;
string z="";
s+=',';
int dep=0;
for(char c:s) {
if(c==',' && !dep) Z.push_back(z),z="";
else z+=c;
if(c=='(' || c=='{' || c=='[') ++dep;
if(c==')' || c=='}' || c==']') --dep;
}
return Z;
}
template<typename... Args> ostream &_gbd1(ostream &os,const string &nm,Args&&... args) {
return _gbd2(os,1,split(nm).begin(),args...);
}
template<typename... Args> string _gbd1(const string &nm,Args&&... args) {
ostringstream oss;
_gbd2(oss,1,split(nm).begin(),args...);
return oss.str();
}
}
bool DBG=1,EMACS=0;
#define dbg(...) (JO&&DBG?gbd_ns::_gbd1(cerr<<"\033[38;5;5m"<<__FILE__<<":"<<__LINE__<<(EMACS?":note: ":": "),#__VA_ARGS__,__VA_ARGS__)<<"\033[0m"<<endl:cerr)
#define dbgt(...) dbg(fmt_time(),__VA_ARGS__)
#define fmt(...) gbd_ns::_gbd1(#__VA_ARGS__,__VA_ARGS__)
template<class Fun> struct _y_combinator_result {
Fun _fun;
template<class T> explicit _y_combinator_result(T &&fun) : _fun(forward<T>(fun)) {}
template<typename... Args> decltype(auto) operator()(Args &&... args) {
return _fun(ref(*this),forward<Args>(args)...);
}
};
template<class Fun> [[nodiscard]] decltype(auto) fix(Fun &&fun) {
return _y_combinator_result<decay_t<Fun>>(forward<Fun>(fun));
}
#define nop void()
#define sz(x) (int((x).size()))
#define all(v) (v).begin(),(v).end()
#define sortu(v) (sort(all(v)), (v).resize(unique(all(v))-begin(v)))
#define forenum(i,...) for(int i:{-1}) for(__VA_ARGS__) if(++i,0) assert(0); else
#define forenumll(i,...) for(long long i:{-1}) for(__VA_ARGS__) if(++i,0) assert(0); else
#define forbs(k,i,bs) for(ptrdiff_t k=0,i=(bs)._Find_first();i<(ptrdiff_t)(bs).size();i=(bs)._Find_next(i),++k)
#define fordbs(k,i,bs) for(ptrdiff_t k=0,i=(bs).find_first();i<(ptrdiff_t)(bs).size();i=(bs).find_next(i),++k)
#define get(x,i) get<i>(x)
template<class T> bool inb(const T &x,const T &l,const T &r) { return l<=x&&x<=r; }
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#ifdef EXTS
template<class S,class T> using omap=__gnu_pbds::tree<S,T,less<S>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<class T> using oset=omap<T,__gnu_pbds::null_type>;
template<class T> using rope=__gnu_cxx::rope<T>;
using dbitset=tr2::dynamic_bitset<>;
#endif
constexpr int e0=1, e1=10, e2=100, e3=1000;
constexpr int e4=10*e3, e5=100*e3, e6=1000*e3;
constexpr int e7=10*e6, e8=100*e6, e9=1000*e6;
constexpr long long e10=10LL*e9, e11=100LL*e9, e12=1000LL*e9;
constexpr long long e13=10*e12, e14=100*e12, e15=1000*e12;
constexpr long long e16=10*e15, e17=100*e15, e18=1000*e15;
constexpr __int128_t e21=__int128_t(e3)*e18, e24=__int128_t(e6)*e18, e27=__int128_t(e9)*e18;
constexpr __int128_t e30=e3*e27, e33=e6*e27, e36=e9*e27;
using ulll=__uint128_t;
using lll=__int128_t;
using ull=unsigned long long;
using ll=long long;
using ld=long double;
#ifdef EXTS
using lld=__float128;
#endif
long long START_TIME=chrono::duration_cast<chrono::microseconds>(chrono::steady_clock::now().time_since_epoch()).count();
inline long long now_U_03BC_s() { return chrono::duration_cast<chrono::microseconds>(chrono::steady_clock::now().time_since_epoch()).count()-START_TIME; }
const char *fmt_time(long long U_03BC_s=now_U_03BC_s()) { static char dur[20]; sprintf(dur,"%llu.%03llus",U_03BC_s/e6,(U_03BC_s%e6)/e3); return dur; }
#define timed(cb) do { dbg("timed "#cb" ..."); unsigned long long start=now_U_03BC_s(); cb; dbg("timed "#cb" took",fmt_time(now_U_03BC_s()-start)); } while(0)
int arg1; bool inp; vector<string> args;
unsigned seed=unsigned(JO&&getenv("sd")?atoi(getenv("sd")):OJ?START_TIME:START_TIME%e5);
mt19937 igen(seed<<1),gen(seed<<1|1);
#define irand(...) _rand(igen,__VA_ARGS__)
#define rand(...) _rand(gen,__VA_ARGS__)
template<class T> enable_if_t<numeric_limits<T>::is_integer,T> _rand(mt19937 &g,T l,T r) { return uniform_int_distribution<T>(l,r)(g); }
template<class T> enable_if_t<numeric_limits<T>::is_integer,T> _rand(mt19937 &g,T n) { return _rand(g,T(1),n); }
[[deprecated]] int _rand(mt19937 &g) { return _rand(g,0,numeric_limits<int>::max()); }
template<class T> enable_if_t<numeric_limits<T>::is_iec559,T> _rand(mt19937 &g,T l,T r) { return uniform_real_distribution<T>(l,r)(g); }
bool _rand(mt19937 &g,double p) { return bernoulli_distribution(p)(g); }
template<class T> T _rand(mt19937 &g,initializer_list<T> il) { return *(il.begin()+_rand(g,0,(int)il.size()-1)); }
template<class T> T _rand(mt19937 &g,double p,T a,T b) { return _rand(g,p)?a:b; }
template<class T> T _rand(mt19937 &g,initializer_list<T> il,initializer_list<double> wt) { assert(il.size()==wt.size()); return *(il.begin()+discrete_distribution<int>(wt)(g)); }
#define random_shuffle(...) static_assert(false,"random_shuffle deprecated, use shuffle")
#define ine(x,e) (inp?cin>>(x),nop:((x)=(e),nop))
#define inr(x,...) ine(x,irand(__VA_ARGS__))
#define endl '\n'
string garb;
void exit0() { DBG=1; dbgt("gg (early)"); exit(0); }
#ifndef MAIN
#define MAIN _main
#endif
void MAIN();
int32_t main([[maybe_unused]]int argc,[[maybe_unused]]char *argv[]) {
ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(ios_base::failbit | ios_base::badbit);
arg1=0,args={argv,argv+argc};
if(sz(args)>1) {
if(args[1][0]=='i') freopen((string(__FILE__).substr(0,string(__FILE__).find('.'))+"."+args[1].substr(1)+".in").c_str(),"r",stdin);
else if(args[1][0]=='I') freopen(args[1].substr(1).c_str(),"r",stdin);
else arg1=stoi(args[1]);
}
inp=!arg1;
if(JO && getenv("EMACS")) EMACS=1;
dbgt(arg1,seed,args);
#ifdef QUIET
DBG=0;
#endif
MAIN();
DBG=1;
dbgt("gg;wp");
return 0;
}
constexpr int inf=e9+99;
constexpr ll linf=1LL*e9*e9+99;
#if __cplusplus >= 202002L
constexpr long double U_03C4__ld=2*numbers::pi_v<long double>;
#else
const long double U_03C4__ld=2*acosl(-1);
#endif
#define U_03C4_ ((flt)U_03C4__ld)
constexpr long double U_03B5__ld=1e-8l;
#define U_03B5_ ((flt)U_03B5__ld)
// }}}
using flt=double; //CARE
constexpr int P=e9+7;//998'244'353;
string _s[4];
string GG="TTPC";
bool s(int j,int i) { i%=sz(_s[j]); if(i<0) i+=sz(_s[j]); return _s[j][i]==GG[j]; }
const int N=1<<20;
bool gl[N],gr[N];
int nl,nr;
int perl,g;
int tot[N];
pair<int,int> ps[N];
ll Q(ll th) {
ll z=0;
for(int i=0;i<nl;i++) {
if(!gl[i]) continue;
ll occs=(th+nl-i-1)/nl;
int il=i%nr;
z+=(occs/perl)*tot[il];
// dbg(i,occs,perl,tot[il],(occs/perl)*tot[il]);
occs%=perl;
int ir=int((il+nl*occs)%nr);
ll psd=ps[ir].fi-ps[il].fi;
if(ps[ir].se<ps[il].se) assert(psd<=0), psd+=tot[il];
assert(inb(psd,0LL,(ll)tot[il]));
z+=psd;
// dbg(i,occs,ir,il,ps[ir],ps[il],tot[il],psd,(occs/perl)*tot[il]);
}
dbg(th,z);
return z;
}
void _main() { /* CURSOR START */
int zq; cin>>zq;
for(int i:{0,1,2,3}) cin>>_s[i];
nl=sz(_s[0])*sz(_s[1]);
nr=sz(_s[2])*sz(_s[3]);
for(int i=0;i<nl;i++) gl[i]=s(0,i)&&s(1,i);
for(int i=0;i<nr;i++) gr[i]=s(2,i)&&s(3,i);
if(nl<88) dbg(nl,vector<bool>(gl,gl+nl));
if(nr<88) dbg(nr,vector<bool>(gr,gr+nr));
g=gcd(nl,nr);
perl=nr/g;
for(int i=0;i<nr;i++) {
if(ps[i].se) continue;
int c=gr[i];
for(int x=i+nl;(x%=nr)!=i;x+=nl) c+=gr[x];
tot[i]=c;
for(int x=i+nl;(x%=nr)!=i;x+=nl) tot[x]=c;
pair<int,int> pr={100,100};
ps[i]=pr, pr.fi+=gr[i], pr.se++;
for(int x=i+nl;(x%=nr)!=i;x+=nl) ps[x]=pr, pr.fi+=gr[x], pr.se++;
}
ll L=0,R=linf;
for(;R-L>1;) {
ll M=midpoint(L,R);
(Q(M)>=zq?R:L)=M;
}
cout<<(R==linf?-1:R)<<endl;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 7748kb
input:
3 TTPC TLE P AC
output:
34
result:
ok "34"
Test #2:
score: 0
Accepted
time: 1ms
memory: 7744kb
input:
670055 TF OITFKONTO GFPPNPWTZP CCZFB
output:
-1
result:
ok "-1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 7652kb
input:
910359 TOKYO TECH PROGRAMMING CONTEST
output:
1401951321
result:
ok "1401951321"
Test #4:
score: 0
Accepted
time: 69ms
memory: 10744kb
input:
518530 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
518530
result:
ok "518530"
Test #5:
score: 0
Accepted
time: 345ms
memory: 15364kb
input:
252288 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
252288
result:
ok "252288"
Test #6:
score: 0
Accepted
time: 306ms
memory: 17472kb
input:
1000000 TTJLTTPNTTQNTTBJTTHZTTJSTTRUTTVWTTJXTTMGTTZHTTRWTTNHTTDWTTMGTTIDTTSYTTPPTTGQTTXYTTOETTYMTTZATTAOTTJNTTHHTTYLTTJBTTLLTTNNTTCITTCBTTDOTTNGTTPZTTUETTFHTTODTTCETTKXTTGUTTZSTTECTTFSTTHOTTESTTNQTTHJTTDPTTFKTTCMTTNMTTGRTTYPTTKQTTYCTTUITTYCTTWWTTZDTTCPTTRSTTLFTTPKTTEXTTUPTTXWTTDATTVUTTLCTTEGTTOLTTRI...
output:
-1
result:
ok "-1"
Test #7:
score: 0
Accepted
time: 162ms
memory: 18052kb
input:
359869 TTXTTTYTTTITTTHTTTRTTTOTTTETTTKTTTZTTTYTTTBTTTUTTTBTTTJTTTDTTTYTTTJTTTKTTTYTTTLTTTATTTLTTTITTTHTTTUTTTMTTTDTTTITTTPTTTITTTCTTTCTTTRTTTZTTTVTTTETTTGTTTNTTTUTTTGTTTYTTTJTTTKTTTQTTTSTTTPTTTWTTTPTTTZTTTETTTJTTTVTTTGTTTUTTTBTTTCTTTCTTTXTTTWTTTETTTFTTTGTTTDTTTATTTCTTTITTTWTTTWTTTITTTSTTTRTTTYTTTETT...
output:
-1
result:
ok "-1"
Test #8:
score: 0
Accepted
time: 155ms
memory: 15000kb
input:
856943 QNTJMTFRTNDTXOTJRTNNTCXTZNTQMTSBTMRTDMTMOTEATOXTHWTOJTQQTLITKRTNSTNITSMTRVTLLTKBTSATYVTHXTEZTRXTPNTEQTQDTVZTMOTJVTESTRQTBBTAXTMNTUBTULTFPTXQTIBTCMTXXTMZTOWTYVTPVTDSTMWTZDTGQTVMTRFTKDTQITKSTCQTOPTSRTJWTFCTEFTCKTISTELTWGTHOTODTQHTLETRCTSHTJITQGTSUTFDTFZTFYTBJTKNTMHTHWTOZTARTZGTQETRITMSTXVTZATKJ...
output:
-1
result:
ok "-1"
Test #9:
score: 0
Accepted
time: 37ms
memory: 13832kb
input:
12 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
-1
result:
ok "-1"
Test #10:
score: 0
Accepted
time: 286ms
memory: 17952kb
input:
1000000 WTTTNTTTLTTTZTTTWTTTKTTTDTTTATTTNTTTMTTTZTTTHTTTVTTTVTTTITTTSTTTNTTTSTTTPTTTVTTTWTTTJTTTRTTTQTTTFTTTQTTTMTTTMTTTYTTTWTTTLTTTMTTTNTTTCTTTWTTTSTTTVTTTDTTTUTTTLTTTCTTTCTTTZTTTQTTTQTTTWTTTDTTTQTTTZTTTUTTTQTTTITTTYTTTATTTATTTGTTTITTTWTTTYTTTYTTTFTTTHTTTPTTTDTTTWTTTRTTTLTTTNTTTFTTTNTTTNTTTCTTTBTTT...
output:
-1
result:
ok "-1"
Test #11:
score: 0
Accepted
time: 317ms
memory: 15920kb
input:
506084 TPTGTATITNTJTPTBTZTDTRTVTJTVTSTFTWTNTATYTKTJTCTBTPTPTJTSTQTGTPTKTYTBTMTXTVTMTUTFTPTRTYTVTFTATCTLTITVTUTNTATCTJTYTOTOTMTKTBTMTMTKTQTWTBTHTITATUTYTNTETRTYTWTDTLTCTPTGTKTMTETGTCTWTMTNTKTMTATDTQTWTWTPTMTRTYTQTMTJTCTGTXTDTUTSTBTYTFTKTGTYTHTNTOTOTXTQTITITSTGTUTMTNTPTETJTDTJTRTBTKTXTCTSTRTZTSTWTUTJT...
output:
-1
result:
ok "-1"
Test #12:
score: 0
Accepted
time: 104ms
memory: 17100kb
input:
95378 JTTGTTYTTMTTFTTSTTUTTBTTNTTSTTVTTKTTYTTUTTITTFTTYTTKTTSTTSTTATTMTTQTTMTTLTTRTTWTTQTTLTTWTTPTTYTTGTTPTTNTTUTTRTTKTTWTTHTTVTTGTTMTTQTTUTTXTTCTTZTTUTTBTTDTTPTTJTTETTZTTNTTOTTKTTITTOTTGTTSTTQTTVTTZTTATTBTTATTOTTYTTZTTZTTZTTDTTPTTHTTMTTDTTLTTNTTNTTITTETTRTTYTTOTTWTTZTTGTTGTTRTTXTTKTTGTTVTTDTTSTTWTT...
output:
27097032
result:
ok "27097032"
Test #13:
score: 0
Accepted
time: 586ms
memory: 17612kb
input:
12 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
10636
result:
ok "10636"
Test #14:
score: 0
Accepted
time: 449ms
memory: 18040kb
input:
1000000 LTTTWTTTLTTTWTTTITTTQTTTWTTTKTTTSTTTGTTTLTTTHTTTXTTTFTTTYTTTPTTTBTTTFTTTYTTTBTTTZTTTYTTTHTTTNTTTVTTTKTTTMTTTITTTQTTTYTTTYTTTZTTTGTTTBTTTLTTTMTTTJTTTYTTTVTTTITTTYTTTRTTTCTTTHTTTRTTTUTTTWTTTQTTTITTTVTTTWTTTMTTTRTTTFTTTITTTYTTTETTTFTTTHTTTOTTTYTTTOTTTXTTTFTTTLTTTRTTTFTTTGTTTETTTBTTTVTTTETTTWTTT...
output:
907999396
result:
ok "907999396"
Test #15:
score: 0
Accepted
time: 192ms
memory: 17232kb
input:
713716 BTTCTTOTTZTTWTTOTTHTTITTITTITTWTTGTTFTTJTTMTTWTTRTTGTTFTTLTTJTTDTTWTTITTRTTMTTQTTDTTJTTWTTHTTKTTRTTQTTSTTETTKTTYTTRTTSTTGTTQTTYTTOTTCTTLTTSTTOTTETTUTTRTTETTLTTQTTYTTYTTITTUTTXTTZTTXTTJTTQTTWTTWTTMTTRTTATTNTTSTTJTTKTTGTTHTTVTTSTTRTTXTTMTTUTTNTTPTTQTTHTTJTTHTTETTQTTGTTGTTATTITTATTBTTQTTWTTHTTWT...
output:
563121569
result:
ok "563121569"
Test #16:
score: 0
Accepted
time: 265ms
memory: 17676kb
input:
11522 TXTTTHTTTVTTTOTTTFTTTZTTTKTTTZTTTJTTTDTTTPTTTRTTTHTTTOTTTXTTTCTTTWTTTNTTTDTTTSTTTWTTTCTTTHTTTXTTTFTTTSTTTOTTTHTTTCTTTWTTTUTTTXTTTSTTTZTTTXTTTLTTTETTTKTTTLTTTXTTTLTTTVTTTATTTLTTTHTTTDTTTITTTQTTTLTTTKTTTETTTATTTHTTTYTTTOTTTDTTTSTTTCTTTVTTTRTTTITTTITTTMTTTPTTTNTTTJTTTXTTTKTTTXTTTGTTTCTTTUTTTCTTTW...
output:
11152921
result:
ok "11152921"
Test #17:
score: 0
Accepted
time: 175ms
memory: 17796kb
input:
1000000 YHTTKJTTFNTTMITTNWTTOETTWJTTCFTTIRTTVJTTJMTTHOTTBITTLXTTRLTTVLTTOFTTMYTTOGTTAYTTVLTTCRTTENTTLKTTKETTXPTTSFTTCZTTGLTTJZTTGFTTOYTTSFTTLHTTNMTTANTTSGTTKKTTXETTABTTSBTTLLTTQOTTNDTTWATTERTTAUTTMWTTISTTASTTZJTTPXTTONTTVGTTEATTVBTTXGTTSITTPNTTLITTLQTTHVTTKOTTQGTTVLTTDQTTLHTTJETTWFTTDFTTIQTTIETTKHTT...
output:
-1
result:
ok "-1"
Test #18:
score: 0
Accepted
time: 178ms
memory: 15848kb
input:
1000000 TTXZTTYMTTVYTTASTTUPTTABTTLRTTEPTTQPTTMKTTCOTTPKTTPGTTSITTDRTTQSTTCPTTXWTTXBTTJDTTZNTTIPTTIOTTKJTTQITTEJTTJRTTAQTTIBTTAETTUOTTUETTDRTTNFTTPZTTYHTTMZTTQDTTCDTTVDTTHNTTXKTTUPTTFPTTYFTTIUTTUBTTJATTYFTTJWTTGUTTPXTTIPTTHSTTVATTHWTTWZTTMSTTJRTTYWTTSRTTUPTTDQTTKJTTIUTTVBTTNOTTBGTTINTTAMTTRNTTAXTTDW...
output:
-1
result:
ok "-1"
Test #19:
score: 0
Accepted
time: 174ms
memory: 17764kb
input:
367325 TSITTGUTTPJTTVDTTSSTTIJTTZATTKGTTPATTCKTTBWTTYKTTRUTTMOTTUQTTEDTTFLTTYOTTRITTYVTTGXTTVJTTWPTTVDTTAFTTSOTTJZTTDKTTBUTTSPTTFSTTHXTTKDTTVJTTCUTTALTTRHTTAJTTZHTTZDTTAOTTJVTTLKTTSXTTFITTDPTTGSTTXRTTEITTOQTTEPTTVCTTSITTJUTTPXTTZWTTPKTTUZTTLWTTYBTTFETTJYTTLDTTGSTTIITTKFTTKHTTUGTTVPTTXNTTFCTTLZTTYXTT...
output:
-1
result:
ok "-1"
Test #20:
score: 0
Accepted
time: 489ms
memory: 17908kb
input:
1000000 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
-1
result:
ok "-1"
Test #21:
score: 0
Accepted
time: 204ms
memory: 17836kb
input:
1000000 NTTNWTTJFTTLMTTSATTRWTTEXTTBETTPBTTEBTTXPTTUDTTWVTTWMTTWZTTCATTSBTTKBTTEKTTNHTTPBTTCATTVITTPJTTCYTTAPTTVLTTDHTTVQTTJUTTCFTTLXTTODTTFMTTXRTTRLTTNPTTVNTTYMTTOXTTDUTTVZTTSDTTMPTTYCTTLKTTFATTCETTUFTTGDTTKVTTGYTTVATTYZTTQRTTWQTTMGTTFXTTLDTTXRTTGFTTPLTTQQTTOVTTEOTTJSTTXSTTQKTTRVTTWZTTKXTTRBTTRRTTM...
output:
-1
result:
ok "-1"
Test #22:
score: 0
Accepted
time: 323ms
memory: 17804kb
input:
1000000 DTTTATTTBTTTUTTTUTTTNTTTDTTTITTTATTTRTTTFTTTJTTTZTTTDTTTRTTTETTTWTTTCTTTHTTTFTTTBTTTJTTTUTTTWTTTJTTTCTTTETTTYTTTHTTTWTTTETTTWTTTCTTTZTTTWTTTYTTTKTTTRTTTLTTTVTTTETTTOTTTDTTTPTTTLTTTMTTTWTTTCTTTXTTTDTTTPTTTVTTTFTTTATTTKTTTWTTTOTTTUTTTPTTTZTTTMTTTETTTWTTTRTTTPTTTRTTTHTTTFTTTYTTTRTTTKTTTJTTTETTT...
output:
452272320
result:
ok "452272320"
Test #23:
score: 0
Accepted
time: 341ms
memory: 18028kb
input:
1000000 CTITITNTHTTTBTZTNTMTFTCTZTJTRTBTUTPTWTWTNTUTMTUTETITITATKTMTRTPTVTXTPTHTNTGTSTMTUTWTKTWTITBTCTHTFTWTDTHTWTBTSTNTNTCTGTVTVTVTMTVTITWTJTRTYTETMTKTFTGTPTXTHTGTXTVTPTHTKTSTMTUTMTLTCTDTHTGTUTVTPTYTQTOTBTMTZTZTWTOTFTGTATBTFTQTNTPTGTLTYTKTPTCTFTATSTDTQTBTXTATVTRTGTITSTITDTKTPTNTKTKTBTATWTKTRTBTMTDT...
output:
975999035
result:
ok "975999035"
Test #24:
score: 0
Accepted
time: 33ms
memory: 11808kb
input:
11 WHLKKWTICHLBXNJKGGFGQLTLEHQUIYKLQZVWFFAVIDVCVJHUSJTYQTIJECJNQCLEJNZPKMPVBPKZHENYFXCSXZEUVJAFLMWIZPDWQDNRPBIGBTMNQKQOGJFEQYDHQYIBZXHBMWTJZJJWYWCQLEDVCUVCDMPEWOXGRADJQGRANTLNMTMHALLKTZYLFZPOPTOGKSTJBGJEGKBONVGJUSQDPBTECDEDGHAZCZOMZBMXVVTNMLPPLBVHLZXASGFRAIBAULIYDEHASZNGQDUBZCRTZYIXBDYWAGOIGCOAAPPON...
output:
6385324
result:
ok "6385324"
Test #25:
score: 0
Accepted
time: 39ms
memory: 15688kb
input:
14 UCBNFDDWTZCYVRYRQCEWBIVBQADDGNHJDJIPZMHCDWLAJDEJXIJIQTUOSNEUONNQIMOCRLSQXBPHDPQYBJLRQMANSCKNMCORGLIGAVBZQWQJKZFYDARHAZWYQOWYBKTWYESJAXNWDEEITRMCAPWAVVQQCCKQBSIPEGYZQXHYLWFOIYQBFESGUABSXJTOLACYNAUGFXJIBICEDPFLCUGQPDVZVGXRBKSHIDMFGEAAAPVCEBZJIZJQJTXQEPLZXFUQYWWPBQIDQDAXCGSBJNMBVOQTPWMTVVIZZTZZNOLBN...
output:
3768074
result:
ok "3768074"
Test #26:
score: 0
Accepted
time: 27ms
memory: 14844kb
input:
621991 PHSWLBLHWDNEUDLSMTKUPSYGZVVTXZVDFLIJERLKFTKBCPATGFTPXCYHAHBCPCFDBHHJMGDDIHSCNHNJMDPGMXXBSVCQMWALQNVOVWESQDBUTDPUMOUFTIHPQPYFUSWARGPFZFVUNNRUBOTHERYQVKCODQOMKXOAKSQEOVEXDNCHYNIVKEJJVJSZSSCQKXDWVMSWEXXKOYMQZSGCLTFQIRZMVVXXPJSGDZWRZYIJOLGGZCAHKUGSMEOHLJZKYZGIEHQDAIGBAPTJQIXUCMZDTDPAWACGFJWUWPRVS...
output:
285656877012
result:
ok "285656877012"
Test #27:
score: 0
Accepted
time: 54ms
memory: 16112kb
input:
681065 BPEIWKXAPGASDFYOVYWFZIFZJCTSZOHAXWADMHJQZAVYZDMYUEBGJMPIFDQIHSWKJZKXDJGLUMRGBSVFLDRWGSDWDXBBNMQFDJLVGSEHCFWYINVJGCGIOXIFVVQWYPVHSMOTSCJLYFNHBWNZHHYBGZKRZBPAYJFRZOICJOOBOVXGEIUXMGEUVYSFUPITQGHGFUPHCPJLBRRXUBLQRQVDSFHCYODJXQJZJKDZWEHLQRJIONJGGDJHXJUTJSXYKXHCAXRLXVRQZNXNZWMUCVXQLUPCIILGAXCDZMQHV...
output:
640624135227
result:
ok "640624135227"
Test #28:
score: 0
Accepted
time: 29ms
memory: 15120kb
input:
36576 IRMNJPGAQZMFDZACMEVLGQSDJLXFAZDQRXSIDMSYFRDHZVQRDZBVXMMMGAPYFJBSHVDQVASDYGLCWKADPAEFHBAXIZWXSMNJYEKSKKNAKESFUQEDOLDZYOIPVSEXKVJPHMZGXOYLWDNJBPRIISSWDYPGICCCERHMHCRYNZFPMYXXUPMAWPUIVGKHCJIQBQPPEDZDXZNUFQOCKZRSRAKCMVMSCBVFAJXUAVFZVUFERGHDXFMHUBOLXCJCNSHIEHNBWJYKOEUTXMKBPGQKWQZRLXYDFTCWLBBIYBFTYS...
output:
1631600024900756
result:
ok "1631600024900756"
Test #29:
score: 0
Accepted
time: 27ms
memory: 14784kb
input:
870492 ADNCVEKYFEDDSBIFJBFNAIHWGFWXLWYGROVNMWHJPTPCHMMFBYAXZFOUBOOCXQLEHLQCHJVJVGSMNPFNHHWOJBMDEASWBBALXBSFXXFVLIBEUMXGSNSKLEKOQGYHRLENMRRKNIURCFVQSXLNJJJNAYYSPFCILXCGCRFCBZDQAHKACQNFDSNKBFYDROLJPDKWZVLAJCUVIFXEHVGKXXKDKOOXFHKSARJMVWXGUYWUCDZOXNFHMYPJOECWNOXQBBWDOSSYUMCMZWSNSXMCBXNZHISVKLDJXABDKOVQH...
output:
2249019642670992
result:
ok "2249019642670992"
Test #30:
score: 0
Accepted
time: 28ms
memory: 15540kb
input:
699084 DMSSXMPXNYSUSGIHNSJDADZYKFGERGBHUVBJQLNZPBQSVFKZNAEGQJCGBAQVBMCFOWAZEJOEPIYSAKEEIDKVBMHVZGUWIGWGHDWMRCXDVAAWHSVMBCVCFLBMMKEJMMUSGWKXZXLKRQVDLUGLKBXCKOQLUOAOXMKUCIMNYVITJYFQPYCAISGUXPPXJJXBWRHCUQSBOXFMZDHUOMIRODDJVQIINHHSDKLDZLZOAOQXVJGCIYWVFLNLRQYLKSDZJVQNNRILUZISWYYKYGESNBPIWDRQKAFVZMUJZKJAC...
output:
2238903359576856
result:
ok "2238903359576856"
Test #31:
score: 0
Accepted
time: 53ms
memory: 17968kb
input:
1 YBBQHUMUHPCOXASQLWBRXUPEORMGCOFIVNDFSNGFJRWRYPACZSVJGKMMLJRUVOVXDVPAFCFXOAXMDGNPCXLZCHGBFCVYYOBEEOIFSNGFRINXEXUGSWOIZUJFFBVOEXPRSOIONPWYRQDKAHUKOVUJKXZCSLVIBWISZLDMXXICKVSEUALMNDLHNHMFBGXSSXJPBEPRBLJXBUIUGEZGUEHNEQAMENIDVJJYHZCPRFUKLRYFGPVYRDIQSEKKEZFZGQUFPSHQLZFMQVQXOMHDRXFMFOFVLWBMNJPIAFYWMFSQDQ...
output:
42737103431
result:
ok "42737103431"
Test #32:
score: 0
Accepted
time: 19ms
memory: 14492kb
input:
1000000 MJIRPODODXHXEGOQKDVQXFKONESHJFWAKFOURAPYCPHRCLUDISEFAOAWWMINVAMUFUWJEWCWYZJDPAVQJPULSSKPNLFHXLNXCYDYCJAYBIHSEHVCWBFXPFQVVRDGMCLPQQSRXDMEOGXPYNXHFIXDVXZRCYOEHUVSEIURMHSPILBWKCZFEYVGZGJAPUMIJIUGQJHESQMLXYKPHHQNGYMVOLJUGLLIWBNPYJMKVLUSLNFWAHFMENNLIDDELSWTKPWRSDXQDSDPAPQSWQLKXODALELSLZSELOQLXKEW...
output:
3392859102435868
result:
ok "3392859102435868"
Test #33:
score: 0
Accepted
time: 130ms
memory: 15020kb
input:
350208 TLTHTUTTTIECTJTTTTNTTTTDTZTHJXSZTVTTTATTJHTKTVDTTXTTTTTTBATTTTTTXTTKTTTTKTTDTTTTNTLYXTTTTTTTFJTTVTTTCTOTZNWKTRPTKTEKETTTTVRTVWCUTTTKDZWVPVMMTTTISJTTTQTTTETTTTTMTTTTRTTITTTLTTMVTTMTTKQTTTWTTTBTWTIGTCTZTTTTTTNVTYUTTTTTTIOVTTHITTSTNZTTTOTTRHTTTTDHTTTUVPWTTTTTUTTTHMLFWNTQTTTFHTPTTRFITNDFTJNCKESTI...
output:
1248723
result:
ok "1248723"
Test #34:
score: 0
Accepted
time: 420ms
memory: 17432kb
input:
343585 TRTTTTTRTETTTTQTTTTAOTTTTWTTSTHTXSTLTTSITTTDTTTHTGTTTTTTTTTBTTTTTTCTVTTTTNTTTZTTTTTNTTTUTZTMTVJTTFTDTTTTTTTYLTTTTNXTTTETMTTTTTOTTTTTTTTBTPTTTTXVWTTLTITINTTTTTZTTTATTTPUTTTTTTTOTTTTTTTTTSHTLTTTTTTTTTTTTTTTTTPXTTTTYFTTAYTPZETTTFTHTAOTTTTTTTTTTTRTTOTTTTTKTTTTTTTTATTTTXTTSTTTTTTTTTTOTTTRTTTTTLTTL...
output:
1468088
result:
ok "1468088"
Test #35:
score: 0
Accepted
time: 297ms
memory: 15068kb
input:
1 TTTTTTTTTTTTTTTTTTTTTTTTTTTQTTTTSTTTTTTOTTTTTTTTTTTTTTUTTITBTTTTTTTSTTTTTTGTTTTTTQTTTTTTTTTTTTTTTTITTTTTTTTTTTTTTRTTTTTTTTTTTFTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTMTTTTTTTTTTTMTTYTTTTTSTETTTTTTTTTSTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTETTTKTTTTTTTTTTTTSTTTTTTTOTTTTTTTT...
output:
1
result:
ok "1"
Test #36:
score: 0
Accepted
time: 76ms
memory: 17696kb
input:
1000000 IHTTXXQVDVKETTPPWTTLLTYATTBCETCLTSEIXTTGTTJTTXBTXTTVTTTTIFYTASPDBTWVHTMVBTLTHTTQWTTTZAIATTDTTTTHGJTSTEZVTYPTTXTTTOLWTEFTEIHUATPTTQWTBVYTTCTVXZTDZTTTZZTMULPUSATTTITTEWFXTZNPTETDTLTUTNTDCTPLITDTYMWCTJTHZTTFTHJNATMBSDJTQTZTYDWFTTQAJTOKTTQKTTCUVTTAVXXUTRTULOTTTUUUZMRMITTTXHTTGTTTOBUTKTMTBPHTTTTT...
output:
4223102
result:
ok "4223102"
Test #37:
score: 0
Accepted
time: 11ms
memory: 15008kb
input:
345046 YHNYBBTUCRWJTYITEQDYYTEHAGBWBETO KT JNFETZVTCUHLGMPNGVMWZZFIXNFGUVSSEBSKMZUJSCFVCDTWPCPBPSPYTKLDOAOLRJJLESLGLOVQLDJMHYSQACKIMABZVTMLCPCAQEXDTJFBLNYCNJWJDDSAXEEICBXVYQGYBPXVNFCHIIXKUMMQXOEMNDYBGNGEJJCQIHHLYFUIZNJHUGSRKVXFRRTEYTCLVWTOSBNFBLZPSSPUFGMMLVYTADJGUGJYGKQCHOCNIZCPDNFLFVNBAHTGJAFKGPJLL...
output:
3140057680
result:
ok "3140057680"
Test #38:
score: 0
Accepted
time: 4ms
memory: 14512kb
input:
990105 T T FTBLKZUGHSNFTKEUEFRULGLILYCTYPKXZJGPQTUUYNZEOVXWTHZDKUMINCMNMZVQDLVVFLKBBFAWUQRFJLHKBRZFNKDOBNVKWQEKCBFXCUJGEGTUPKJHGQEDFEVXTNVUTJEMIIYWJMHVXDABJPUAXZLHXFRMKFMOFUPKTNELPOGHIABOSMCKQPQHEWKCKGGXTAXMAGXSCKXBMHSVMORIDRLLXWCUCYTUIROUNUNBIDNAXBQSDYWNVTYKRPWEJDWJRIIACNIUPXJUKAMPAVULCAKXGVEAXYTDT...
output:
866652802
result:
ok "866652802"
Test #39:
score: 0
Accepted
time: 29ms
memory: 8692kb
input:
749386 DUGGXTKUUHOZRLDPEVBNGEZUQPUDQFGHYQNMPMJRMPSFVFLECMGXNFDPQZIQCIUDUBNVIRAMTDMDDQRMJZEMKVEDQWTJIUUQOMHGEQETZUWIIOXPRUMAYLEGQDNRATLWXLYSYWMNOCBPITAKFYBMXDPOSHNZIEOWXCWDUNBSPNVONUBUPANOITVOIRJNEXUIWWLJJNJAMIMHLFMVHISWXDXNAYGTTKXRNEYTLKBKDULTHDBMSLTRHTAYRCGCCTPZEYHLYEWOFNQXOOIOGSHANWZGGEZJPVNJDFJVS...
output:
5798101706
result:
ok "5798101706"
Test #40:
score: 0
Accepted
time: 18ms
memory: 7880kb
input:
866202 UXTLRNTHESMXDHIJJQMRBZTFUVPADFGJWOEYLEDDHYCBJXXCHWTUWBDSKUDMFBHOQEFTPECMBFTSJKAPNTJLWSJCTHDKPLEKAZGZBXFZBNURENZXPJDSGMCTLAJNWKPZRWNDNJUAEOBZLYWFUSDCEVVADQZMVZVMFWNBBMSGOTDHGVOPBFLEYIQEKHOMADATVMIKFJUSNUCMZKFTTLQDNGCFNXYVMHEEFQUVPCCGKPXBXDPUVHWPYVGMOBAQDANKOWKTDATEPPINMNRQLRWPIJPHMJEMRINZZDDQI...
output:
23920713675
result:
ok "23920713675"
Test #41:
score: 0
Accepted
time: 13ms
memory: 14808kb
input:
610175 LMSBGVAMNSLAUVFWKDZOQFMBUDYXLKPRYOKNBWNPNNGNOMHAJZKXKIURGJQYZFOAKUAAMOENJFADLHXRLAXCXZEMUFRJAFDOGNIYZIQLPFKJGRJZUHSWECQRVACLYXDBRZAJRANHCFCRWPXRVNJSYCXBBMSXFSIRSBNBVGNAQCPQNLZMUIHYKJYWCDHHKANZUXWWCAVPSVSLEJSCCUAUEORRMADXIAIXUSLEUQRUDGHXIPDVPEZRADAXXVENMHGSOXPKKZGKNNCVSKGCKSZLZWVJIHMLAZXFVRUQH...
output:
-1
result:
ok "-1"
Test #42:
score: 0
Accepted
time: 23ms
memory: 15652kb
input:
756402 XSCBCBAPCCEYMGHJSUVDLMSSKUWBEQWFBWGEORUIKDAEKLGMAZRZJSARWQJNJGADAUVAJCMJJLHUWUCRDXSLBIGARBXRBONWZYPFXLNLUCLIIJMWVLAVXPBSJHCBXAPHGGIQDSGKOXJCALHCALARIKDNYPSHCKIESGSMULRBRJSAMFPOYVZOPNAYPCGBHVVWDDMNOUXWAFDVXORXMAYPYZAYUCDFLGKJERDJZZZDAVBDQPBOXEWUBNECAPJJXWKHHRIQVQRJVQOPJDAUYLNLPZDMYKRFGFLIMGYNO...
output:
-1
result:
ok "-1"
Test #43:
score: 0
Accepted
time: 37ms
memory: 15540kb
input:
919744 USJEGOJVYQVJIGPJCGEIMWJIPVBISYGBFEQXUFEIICJUNOLOKGNFJODMSRFRRKJXLJWQBPFFVJIHAWXZEWUJDXUHYEJHODCQFHUHZGIRKBJDPHDZARJZZZXULFVUJCWAKDEHWQIZDGKXEWIOIXXDRSAYJPVFVEDSFDVGHNWYRFLWHBWDDYBCRYDWWWQGCPOXLCQEUYXGNLOMXWPYQAZCMFGDZYZNKUKGWCMPDGZKQDQPNBOLRDPQUWMFOCNRRLXUDESUCDHQSPLXCGXHRXVFWQCPCLXDPJDIXQASG...
output:
-1
result:
ok "-1"
Test #44:
score: 0
Accepted
time: 10ms
memory: 8248kb
input:
178094 HZWHPASQGCMRKYNSKGRXRJSSNSOLLIGZEENWSGMGLOTSKUELOFMOEHRAOSOOMPTEYRNLCOKTZGMOORBSCTKEPBRSMMVCSIYDCLHYRNRBMNIZWAPEBXANQGFDCIUWYXXMSOTGLBYBUWPOZJMSRSBVYMUKJECRZOZPSILNUOTXNISNQYCGQVYIEHNLLLKLEWONDQLRTGQNTFIPEJNYTKFCOZNCCQBGXTABPJWFJGGUUFRJKDMUBXQWWIMOZMNMMURSTVIKZFNSTJFUJVUVGJVOWCZDNJQQIDCDZXFOY...
output:
101851007373
result:
ok "101851007373"
Test #45:
score: 0
Accepted
time: 4ms
memory: 8728kb
input:
39543 AQPXLJNTTQLCKBXEYORIHKWPLZLRDSIOGTQLDQRLOZKCNFOAJSVRSWQZRJPKLJPUNGYTUWNRXBMDONTILKYKYLGNKGBFTTOKQWYDDULORMCAEEIDPJLBHKHLULTTRQLOPONMWUFZWSRFHHHNVKUVMRNALCTKSJUPC SLUDMGAUPMFSUYJLEATOTPVLJIRRVFXXUVPKYUINMHEUXHLHCSAAFCJUSMPLUOABQUCZPUIDIDDSCDDOGALBXTVHZONATVYSYOIQWAIZFGPBLCBUAMAXTRQQGGMJAGETSVBM...
output:
10428475413
result:
ok "10428475413"
Test #46:
score: 0
Accepted
time: 22ms
memory: 13228kb
input:
513749 FTFAAVVEXZFCJHJLRTXHZBMFWRZZJFGCAFKJCRLJGXNCGNWTHEIMSNFDNREGTRKBYPBQFOGHIIXXQHALXTQFKQUVQJDUSNQFEUENDGMMHKTRFHQTYCAOWJWVNCVYIBKHXMAGDXXIOARCQZZFMRKPRYYPOVFSPCRCBNEPIVSFLMCRAFFXTAVBLQDFXWCFIFSMPOHRZPVAWZFXKSMQNXDIDCVBKKATUEJFUIENPGRCLJMBUJADEUAYAZPACDTKUUMUKMXKEAKJMFDBQWMKZSDEPZIPWRKKOJQONPKCZ...
output:
297904535175
result:
ok "297904535175"
Test #47:
score: 0
Accepted
time: 8ms
memory: 12448kb
input:
323568 HPCBEXJKHBICZDFYOPUZNIQSKEYEYGWNWNOUBKXZMPPYMIGWASAESQDCQELHRDQZHDNVBJVAOPSRCBQIYPLSQJXMFZXSYESFHXPXIABQLIKDZZKTFXEOIFWLJXHPKXUJGGUQLMRAOBQDQRKHQFMOUAVFBCIDFHCMRREKMXDJRYBFJNDDQCZAJRLVMZFEMFVYKOSIWAXUHSKEHKONJGSOUBLAAEAMBOGYVIDHBTPDPGJKWMBNNOEUCPWLEBHSHLISZMLSNKQQPIMJKMWIGINMCXBNJHWIJKFQAJPYQ...
output:
195139073323688
result:
ok "195139073323688"
Test #48:
score: 0
Accepted
time: 12ms
memory: 10684kb
input:
999097 JMLDZBUFHJCMCBZYSICXVXSAMWHRXBKGLRINYIVJFMREUNGWXGJHXJCRIBDPCCYBPSNUAGERMXJHRVPLHVGFGBZBXEDZZXYVXNQRLDNOLJMHALPKLOWTZVTYVDAVSJXGDAQNSGHHMNEAXBKBVCVUMAPUUJKLUQIYVMIZDGOCWOAFXNRQNSJNCHLHMJGBQBFCQMHFNKUABXPNEINEZMWCG XKZOCCLIDPCRBKZUZVWNYHEKNEOUEJMSRFYCLLKPBPSSCXXZIXQQQOGYVDYXJOGPPIROKXONZLBKUJR...
output:
-1
result:
ok "-1"
Test #49:
score: 0
Accepted
time: 25ms
memory: 9124kb
input:
655651 CIXDKABYGNOFBFJPZMQHEVRRUGCIVXAADZKVXLGXRKWSOKESCXMGJYRHAVKRHGNWRQIUWRHHQMYKULBFOEVUDSIGGNVABJFXWQOTDUSRDEYQZOHNPKJEZCIOJIBLSYKOXCSYRBPNKWZZBIRZLRBVKJXFXQUQRPCQKGMOKOBTYYQWKJILUCZQLIYLLWDOLRZEQUEDYHQLXSXCBWRFMZHPUWPRMSHIROBBEVXRSFCWOUULSZWRGHJKSKWMIISEIGYMXQHKKBCKGIVWJOHWQPVUFGNJQUYJXHCKYSYCW...
output:
2634424714338390
result:
ok "2634424714338390"
Test #50:
score: 0
Accepted
time: 0ms
memory: 8308kb
input:
622657 BOEINRYGECRHNYPWZVYUZBIHUFQESGGOBLRUGOIDJEJZFSANFJRXLCKZPVBJCARZEZBXVEFSBPIJSJWXEMWDXOXPPHDLVQKKJDDKCSKNNHFASMSBOHOMABBBNZKSYIASGIUEWLMLVOXDFOFSIVOGWFYFMDEXJANBURYSWVBXZHRIYQLVPDMNKJQKNJRXCSMSOOIXELGDLKHSPVVLDHJIZKYAQRXHVJBDUNBUCIPPBSXXZLIVJRLSIPFGRYJOSEXQJIAYWAAJDPQISAVYBZFKAPWJFBGJXVQVVIMSW...
output:
-1
result:
ok "-1"
Test #51:
score: 0
Accepted
time: 0ms
memory: 7760kb
input:
1000000 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTTTTTTTTT PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
1000000
result:
ok "1000000"
Test #52:
score: 0
Accepted
time: 0ms
memory: 7948kb
input:
1000000 GTTTQTTTNTTTXTTTQTTTLTTTZTTTBTTTKTTTBTTTDTTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT PERYPSRBPGFUPTIAPBWNPVLLPJCYPGTHPSHL CCCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
-1
result:
ok "-1"
Test #53:
score: 0
Accepted
time: 0ms
memory: 7748kb
input:
929626 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT ATILTXVTOBTSXTNVTHUTUSTCWTBGTKSTWMTOJTVPTS PWPPAPPKPPQPPVP CCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
-1
result:
ok "-1"
Test #54:
score: 0
Accepted
time: 0ms
memory: 7732kb
input:
1000000 TTTTTTTTTTTTTTTTTTTT MTTMOTTULTTOITTWJTTAOTTGMTTBXTTB PFUPPKTPPOWPPLZPPNOPPKGPPLIPPGBPPQGP CCCCCCCCCCCCCCCCCCCCCCCCCCCC
output:
-1
result:
ok "-1"
Test #55:
score: 0
Accepted
time: 1ms
memory: 7916kb
input:
5633 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TULTWITPZTXJTXQTGFTPDTHVTKB XPPIPPTPPVPPOPPIPPAPPLPPPPPTPPWPPMPPEPPKPPHPP CCCCCCCCCCCCCCCCCCCCC
output:
253465
result:
ok "253465"
Test #56:
score: 0
Accepted
time: 1ms
memory: 7816kb
input:
1000000 TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TQYFTPAZTCWHTSHRTWKVTTBCTVTJTNVU PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP BCCCXCCCXCCCWCCCPCCC
output:
15999995
result:
ok "15999995"
Test #57:
score: 0
Accepted
time: 0ms
memory: 7824kb
input:
1000000 ZBXHCHSZMLVPLQGGTJDROEZBFDEQ DKDOKMUWXYLODPABTHGCFRYICACVVDMICSOHBUBPHUWOI CIBJMYEHQHLLWFYSPJJCGTDAYNNWUAISUYUZEDOGRCD ANOJKQAXPJTNDGSHCQSDSAFBXWDDKRVHEQROPZKZS
output:
2221377778637
result:
ok "2221377778637"
Test #58:
score: 0
Accepted
time: 0ms
memory: 7948kb
input:
1000000 WZENZHGEFMTHAZKSMODUCBNFDDWZCYVRYRQCEWBIV BQADDGNHJDJIPZMHCDWLAJDEJXIJIQUTSNEUONNQIMOCRLSQXB HDQYBJLRQMANSCKNMCORGLIGPVBZQWQ JKZFCDARHAZWYQOWY
output:
1080349150532
result:
ok "1080349150532"
Test #59:
score: 0
Accepted
time: 1ms
memory: 7712kb
input:
999931 YZQXHYLTFOIYQBFESGUABSXJOLACYNAUGFXJIBICE DPFLCUGQPDVZVGXRBKSHIDMFGEAAAPTCEBZJIZJQJXQEPLZXFU QYWWBQIDQDAXCGSBJNPBVOQTWMTVVIZZTZZNOLBNUVDGDBHAL SEAMROELTNSNJHCSUONPLHIWTILGSKZZSKZEBVS
output:
3917276603931
result:
ok "3917276603931"
Test #60:
score: 0
Accepted
time: 1ms
memory: 7700kb
input:
1000000 BIHBPVPHYTWZXITHWCEXISNZDNTCZEBTNHZFWIOAEPZCOBUNWL OLIBUOONULIOXSTJTQGSUQDIQEJFOTOTIDKIWZRAP ENGELUGMJLBACDRYPHEKPPVPXQIURFGOYOMUOVEKYLQUIMWF APRFKDFOUVYYOAAMCTYWCHFITGVIMCCEQUZDPJR
output:
13324982182
result:
ok "13324982182"
Test #61:
score: 0
Accepted
time: 0ms
memory: 7988kb
input:
757219 SWEXJTINTTWDVHGIRGRWKBXJLSEHPLHTHTDUDSR KEHMUTHUGBTTACTTG EEYLFRCHPVUCUPTNKCEIYJWCKRCFLJDPPBPXTIJI AIETPYGASHCOOXKHCCRPXCJFKDFIYXC
output:
996058294
result:
ok "996058294"
Test #62:
score: 0
Accepted
time: 1ms
memory: 7752kb
input:
629201 TT VTTTT PUTLPFRQRP C
output:
3146005
result:
ok "3146005"
Test #63:
score: 0
Accepted
time: 1ms
memory: 7744kb
input:
147204 T TTTTTTTTT PGFQGLP ZKLCQ
output:
2576064
result:
ok "2576064"
Test #64:
score: 0
Accepted
time: 1ms
memory: 7976kb
input:
805507 TTTTDCVT TTT PPPPPJNPP CZCPVKPCB
output:
3866419
result:
ok "3866419"
Test #65:
score: 0
Accepted
time: 2ms
memory: 7688kb
input:
524954 TPBTKTTGTZTYPTJTTZOTTSFGLTTLKTTTTTTTTTOJ TTTTTTTTTTTTTTVTTTTTTTTTLTPTTTTTTTTTTTTTTTBTTTTTT PAPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP ZDOCSCCBCLWUCJCFCEMCANCKCCCSUCC
output:
2352475
result:
ok "2352475"
Test #66:
score: 0
Accepted
time: 0ms
memory: 7988kb
input:
127002 NCBTQETTQTLTTTTXT TTTTTTTTTTTTTTTTTTTTTTT PPGPPPPPPPPPPPPPPPPPPPPPGPPPP GICCBDGADCCTCCJXNCMMCJFCCGLRJXCZCZANYCCFSAXPWEFGC
output:
841691
result:
ok "841691"
Test #67:
score: 0
Accepted
time: 0ms
memory: 7728kb
input:
1000000 KTTFJIMTODIDGTDJDTPTKMDTTIPBUTTGWGSPRXNJUKT TTTTTUSTTTWTTTBTTTMCTTCTTTTVGDJTTWTYTTTTTTFPTT PSPPGWPPSPNAQPYPFUPPPEPPPPPXPRPXJPYPHPU ECCCACLCZCCCCWCAXCYUCGCAHVYJSFCMD
output:
26472458
result:
ok "26472458"
Test #68:
score: 0
Accepted
time: 0ms
memory: 7980kb
input:
936720 TTCTOGTB TTSVEZEWXWTQYRTOTNAZGZLNNOCXTHTTMQN BHOIRHPUNP OQGMCHXRC
output:
147533297
result:
ok "147533297"
Test #69:
score: 0
Accepted
time: 0ms
memory: 7744kb
input:
1000000 TTTDYJTTT FIZTUUTTTTTTVITTDNTTHOITXTTYTFTKTFTDTBHXTK PLPPPPPPPPPPVPPPPZPPP J
output:
-1
result:
ok "-1"
Extra Test:
score: 0
Extra Test Passed