QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226617#3305. LCS 8IshyAC ✓2427ms4424kbC++142.8kb2023-10-26 10:54:322023-10-26 10:54:34

Judging History

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

  • [2023-10-26 10:54:34]
  • 评测
  • 测评结果:AC
  • 用时:2427ms
  • 内存:4424kb
  • [2023-10-26 10:54:32]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define DB double
#define MOD 1000000007
#define ls(x) (x << 1)
#define rs(x) (x << 1 | 1)
#define lowbit(x) ((-x) & x)
#define MP make_pair
#define MT make_tuple
#define VI vector<int>
#define VL vector<LL>
#define VII VI::iterator
#define VLI VL::iterator
#define all(x) x.begin(), x.end()
#define EB emplace_back
#define PII pair<int, int>
#define SI set<int>
#define SII SI::iterator
#define fi first
#define se second
using namespace std;
template<typename T> void chkmn(T &a, const T b) { (a > b) && (a = b); }
template<typename T> void chkmx(T &a, const T b) { (a < b) && (a = b); }
void Inc(int &a, const int &b) { ((a += b) >= MOD) && (a -= MOD); }
void Dec(int &a, const int &b) { ((a -= b) < 0) && (a += MOD); }
void Mul(int &a, const int &b) { a = 1LL * a * b % MOD; }
void Sqr(int &a) { a = 1LL * a * a % MOD; }
int inc(const int &a, const int &b) { return (a + b >= MOD) ? a + b - MOD : a + b; }
int dec(const int &a, const int &b) { return (a - b < 0) ? a - b + MOD : a - b; }
int mul(const int &a, const int &b) { return 1LL * a * b % MOD; }
int sqr(const int &a) { return 1LL * a * a % MOD; }
int qwqmi(int x, int k = MOD - 2)
{
	int res = 1;
	while(k)
	{
		if(k & 1) Mul(res, x);
		k >>= 1, Sqr(x);
	}
	return res;
}
const int N = 5e4 + 5;
int n, K, m;
char ch[N];
int f[2][10][1024], ans;
int now = 0, lst = 1;
struct Saya
{
	int a[N], b[N];
	void Decode(int p, int x, int S)
	{
		a[p - 1] = p - 1 - x;
		for(int i = 0; i < K; ++i)
		{
//			if(p + i > n) break;
			a[p + i] = a[p + i - 1] + ((S >> (K + i)) & 1);
		}
		for(int i = 1; i <= K; ++i)
		{
			if(p - 1 - i <= 0) continue;
			a[p - 1 - i] = a[p - i] - ((S >> (K - i)) & 1);
		}
	}
	int Encode(int p)
	{
		int res = 0;
		for(int i = max(0, p - K); i < min(n, p + K); ++i)
			if(b[i + 1] - b[i] == 1)
				res |= (1 << (i - (p - K)));
		return res;
	}
	void Trans(int S, int p, int x, char c)
	{
		for(int i = max(1, p - K); i <= min(n, p + K); ++i)
			b[i] = max(b[i - 1], max(a[i], a[i - 1] + (c == ch[i])));
		int T = Encode(p);
		int y = p - b[p];
		if(y > K) return;
		Inc(f[now][y][T], f[lst][x][S]);
	}
}aya;
int main()
{
	scanf("%s", ch + 1);
	scanf("%d", &K);
	if(K == 0) return puts("1"), 0;
	n = strlen(ch + 1);
	m = 2 * K;
	now = 0, lst = 1;
	f[0][0][0] = 1;
	for(int i = 1; i <= n; ++i)
	{
		swap(lst, now);
		for(int x = 0; x <= K; ++x)
			for(int S = 0; S < (1 << m); ++S)
				f[now][x][S] = 0;
		for(int x = 0; x <= K; ++x)
			for(int S = 0; S < (1 << m); ++S)
				if(f[lst][x][S])
				{
					aya.Decode(i, x, S);
					for(char c = 'A'; c <= 'Z'; ++c)
						aya.Trans(S, i, x, c);
				}
	}
	for(int x = 0; x <= K; ++x)
		for(int S = 0; S < (1 << m); ++S)
			Inc(ans, f[now][x][S]);
	printf("%d\n", ans);
	return 0;
}



详细

Test #1:

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

input:

ACAYKP
0

output:

1

result:

ok single line: '1'

Test #2:

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

input:

CAPCAK
1

output:

896

result:

ok single line: '896'

Test #3:

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

input:

WEDONTNEEDNOEDUCATION
2

output:

24651976

result:

ok single line: '24651976'

Test #4:

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

input:

WEDONTNEEDNOTHOUGHTCONTROL
3

output:

224129308

result:

ok single line: '224129308'

Test #5:

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

input:

ACAYKP
3

output:

4789698

result:

ok single line: '4789698'

Test #6:

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

input:

CAPCAK
3

output:

4984867

result:

ok single line: '4984867'

Test #7:

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

input:

WEDONTNEEDNOEDUCATION
3

output:

22786993

result:

ok single line: '22786993'

Test #8:

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

input:

KAIST
3

output:

1384274

result:

ok single line: '1384274'

Test #9:

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

input:

A
0

output:

1

result:

ok single line: '1'

Test #10:

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

input:

B
1

output:

26

result:

ok single line: '26'

Test #11:

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

input:

C
2

output:

26

result:

ok single line: '26'

Test #12:

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

input:

D
3

output:

26

result:

ok single line: '26'

Test #13:

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

input:

RUN
2

output:

5409

result:

ok single line: '5409'

Test #14:

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

input:

PSUULHCWHL
0

output:

1

result:

ok single line: '1'

Test #15:

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

input:

OVASGWSKVN
1

output:

2492

result:

ok single line: '2492'

Test #16:

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

input:

LWUBHKTOPO
2

output:

1207903

result:

ok single line: '1207903'

Test #17:

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

input:

AJLOYNZOBR
3

output:

210748912

result:

ok single line: '210748912'

Test #18:

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

input:

BALEZEXVDLJG
0

output:

1

result:

ok single line: '1'

Test #19:

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

input:

PCCCZLAHEYJY
1

output:

2991

result:

ok single line: '2991'

Test #20:

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

input:

ZYXMMJAVCCQF
2

output:

1903794

result:

ok single line: '1903794'

Test #21:

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

input:

ZCMLLLZQSDOW
3

output:

425094268

result:

ok single line: '425094268'

Test #22:

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

input:

PHVAVJWOCJXCLR
0

output:

1

result:

ok single line: '1'

Test #23:

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

input:

JOLIGQVHOTGHKU
1

output:

4888

result:

ok single line: '4888'

Test #24:

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

input:

XOCAQTLVCOLTLX
2

output:

5030491

result:

ok single line: '5030491'

Test #25:

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

input:

KSYAUEQWAEGPFF
3

output:

621029949

result:

ok single line: '621029949'

Test #26:

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

input:

NUGTENEBJSHVHXKN
0

output:

1

result:

ok single line: '1'

Test #27:

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

input:

JWVPOVQZBMXOQLKM
1

output:

6386

result:

ok single line: '6386'

Test #28:

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

input:

QQLFOVJVMEQGOBHQ
2

output:

7757339

result:

ok single line: '7757339'

Test #29:

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

input:

OYINSEAHRIHHETJB
3

output:

936564349

result:

ok single line: '936564349'

Test #30:

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

input:

DCQMOZZSQVICIKGZLW
0

output:

1

result:

ok single line: '1'

Test #31:

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

input:

RTIXCFAPMOQPVFVWZO
1

output:

8083

result:

ok single line: '8083'

Test #32:

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

input:

EEIPKBRXDZRZYDJABN
2

output:

12831727

result:

ok single line: '12831727'

Test #33:

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

input:

CHMAUTTYYVIUEPFZSV
3

output:

271916449

result:

ok single line: '271916449'

Test #34:

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

input:

KIMCYYYYZMQQTXGXWDBJ
0

output:

1

result:

ok single line: '1'

Test #35:

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

input:

HVKZYMPVIPQFXTCGYXJV
1

output:

9982

result:

ok single line: '9982'

Test #36:

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

input:

OXXGRYUWWPHDIDTAVFUI
2

output:

18069521

result:

ok single line: '18069521'

Test #37:

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

input:

ONBQZEBNLCGSWQJMLCSK
3

output:

679096242

result:

ok single line: '679096242'

Test #38:

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

input:

UUUUUUUUUU
0

output:

1

result:

ok single line: '1'

Test #39:

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

input:

LLLLLLLLLL
1

output:

251

result:

ok single line: '251'

Test #40:

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

input:

DDDDDDDDDD
2

output:

28376

result:

ok single line: '28376'

Test #41:

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

input:

RRRRRRRRRR
3

output:

1903376

result:

ok single line: '1903376'

Test #42:

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

input:

HQUWXLBTGTRUOODTQXRCFZHJONUEUDXUJSEVKIMEPLRWKWWQKCAQZSWHTOSBBEWTLNDOGYLDCPYTILRKAKHYVEWVHXIXVXCMMTCOVZCRDGCHZGCMJHOTFKHWRPLCAUMYFAILSNXBRXOIGMFOVXWXRQACPLMAKBOTCXECCDVRFPUGSDHLEQAEARIGMCLFQAJEFFLBSPLYVJHGLNWDMGGZPHVJLDVUJXAETWDJZPFNMKUOVAOYHEOMZDPQXHBCKPQLVYGWQHKZDFXKZXAPILWRDHDILBAELCQCRRSCRDIUCNRT...

output:

1

result:

ok single line: '1'

Test #43:

score: 0
Accepted
time: 49ms
memory: 4408kb

input:

RVRJTJQAVRCSAPFBDVGRMQEURXTLSTIYXITFBICIWIEEDXZNNNYULADHOWSYAICFFEAKZTNOKRXLYRAVAZXHYNZLDXISVFTETLEMNOTFYKVHEIEADSAEKOJMONKYMXPSKQOFSNDEBQMNNNXWESOLKZEHJNBHFFCISPDLKHACRIXJXASFPXEEMUOMEVOGWSWTGXQRSCULYYMUKQTOJKRUNECCPVYUVILYEGCEXUVROGMHAMFBRUETOZUVPATKONFOVCILIBIDYLDGIHTZQBZDEOUNUSNFWABZFOQRDXRMNIEB...

output:

68796748

result:

ok single line: '68796748'

Test #44:

score: 0
Accepted
time: 358ms
memory: 4320kb

input:

NISAPKXGGUZNNOKAVRLFFLMXUKKHALQZGLVGFTEZIJIGXSQNPPTQHUBKXNMTGNWCYKVIITRJOKVLGQCCAYVDBUWKNVNSJFQWGKPMURYGTVDPVLBWCNBAHTUNZWAXZVHPNSZVTDPMWEYHNGPFFANGPVSPVKKMUWRFHQDPAKVURHXYZXZXDDZTGBRQSBLHKMDNSTTYTJGQOLLJEFHXRFDTUWVXWDDGRQFGSREMZPREQLOONQKZZSEYAZRLKLYZIAGAZOODIQBHARPHFDRNMMCMVDKBOYQJLGBWVWFDKLIHUFOA...

output:

899592736

result:

ok single line: '899592736'

Test #45:

score: 0
Accepted
time: 2271ms
memory: 4264kb

input:

JPVAJPOTPZZRKSMHWUOGGARJFACLBXIFDCVCCRPFFRGBTLPOGTKLYDDQFLTSMNLLLXFIXDALVGFGBCGMRGDTGRYXFTNAVNTFWNWVQTJAKIKFQTIZHPBKJORQEYHRMZUTDHSWMBPEDRAVOIQLTCNYGJKSSBPKEKJCRIAYGLJJLYBRQJCHFYZRSGPUBZLPGSLCOCGQNZAPPVYDAVAFXNZLSZPUXCWPEENSZUZZKZILJAOXRSPIEZRZNOQLWAHKGFZKNKMAWFIYGNRWKGNZNEYMFKNEXFCPABIVPIFNDCIMTXUK...

output:

585665949

result:

ok single line: '585665949'

Test #46:

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

input:

YTXGIBVAGKTOEAOEFXKTEJZTFHJPIZSCGUCCQGHXSVAVQZBALZRPKNYPXLBIJZFXQUJNMCGZZJUWYNTZSKFXXTHVDKLJWSYALVVBBJLTYOAVFDFEFYIAVIEIQVRKZBSWWVOIXJKCGIIEZKAKWNEXTSUCBSFAFDKLITQRFIJMIITHYUJLFYHYPXNMZCQQTQYUDXXPBCJMTMHMPRJSSYGHYAXJYTIFPXNJIIWVCJVVLYXZMTFNZCFHHCNHXGRBHCOWACMCMNYCFPABMZIIXZONMPIDDRUKFGLYVKQTILJOOCGD...

output:

1

result:

ok single line: '1'

Test #47:

score: 0
Accepted
time: 49ms
memory: 4212kb

input:

LVNXQKLMVVWEDFSLSHDBLJMMJHJMBNIHMBLQVCNKUTYIZVQAHBFQVQTVKKZZXLZXIMPWXGTZPFUGABQFSACBXNSLGMQKWZCIOJBBNVFNEPTJVLYBVICUYCKIODBNRHRJAAVRORRHQYHBZUVCTFFGZQNYSQDCCVKPAEFKYIZNQJPEOIXOSJHPBYZZGUFNTVULEALKZZZMDURTWYIRXSXIAXCBBLHQTZRZTWPVLVKGGCYEUCFTWJSOLAKXLVBJSJDBNHIRKMEWQXKGJBCILOYYLFNDHUQGNDWRZUZBGJHQSLYG...

output:

54998437

result:

ok single line: '54998437'

Test #48:

score: 0
Accepted
time: 359ms
memory: 4324kb

input:

IUJKHOAKZJCMVZJYIOGRDREZQWDDRFPVSYTEYICNQYIVEXMTVRNBQSFFCWPGFWYLLQWHCOLBUNQMKGZWJPLTZZGHRHTIUJADFOBJMATZTEXJNKMYBYAHMNOMGEOCLAMGGDPPGRAMFJTWIVGVFLLHICSZSQWPTPOPJKIJFHIYLLMEUCYMSSLHTMUIYWRYRMQOEPZMLXADGUUBHEQTAFRLBRJNFAQVJAIIUYXVGFSCIAMUVMFLKXYTCZLJEOMUTNNFLEBLMMSYPKXERSKITEVAUVEEVPJQZLMTHVYSEBTQOWPI...

output:

965126013

result:

ok single line: '965126013'

Test #49:

score: 0
Accepted
time: 2272ms
memory: 4392kb

input:

WTIVAXYBTEKWRCYMXZYWKCBIHAXVWPGTSDYILHLBTWAIDPZNESOVDVEIHZOIOUJWCROZNAGBMMNZRKDPBFXHZENBHFAQBCSIAXOJNZMJXIKNKBXOXZHNDRLAYNIAZNPYNXSCAQBSFYFJMYECEVKXVZUUFPUSGTHNGWQRWLJSVLGWBXTHXXXJYZMQOEOGVXDCMPKMBDCVXGLKCEZLNHQKZZAWPFQKMIFQXUBKSCNTRIAWPIOIKSXMCOALHAWMEYPVXCRQGFKQZAGNJEHYAITPMWNIUVMGEMXUCARAWALDEALQ...

output:

390560171

result:

ok single line: '390560171'

Test #50:

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

input:

UGBNFRGZWFSLEHZQOBXHEHQMCDCUCFPTSLONDCTHJUZYMJQJTUVUOWTBFAUGMWZNEGOPPALDUKCVIUHHUEAWYNERVVBZAAMEYMGNHDUJADIJJZIKKHGOEBESEULLMFRAKUOOJBOTBVSEXOEZGBTJHQKSWWXMICNSNJLYGOCDKBYHZWDISRVFCGLQPOGOUSFWAOKKBZHNIVRQWPNVEAMMLUFMXKZFVKVEIRHJNNDBSDZWIDMICCROXCOLKWJPBKEKJFQNGEUXSZCPGDWBLUNPWUHNTNZSJBGLLWGNLFAWJHGL...

output:

1

result:

ok single line: '1'

Test #51:

score: 0
Accepted
time: 49ms
memory: 4324kb

input:

RKKYDFZZHLHTXBJNYQQXRSXJSVANTQFMIAPZOVNCOVFJADLHBRIPGJKXZGFAANJIMGGFHPDUMIOJIXYVACYOYKXDNTJFQWLREFNMZZBCSTGGFWQBODBLNBKKMJJOKIVRCPFTVXLODGYFSNPRZMDIFWPAFPSDBCSISINJBIYTKAVBJAWNXFDQKXPMMXXVDILWFBESTLJZZYEVXQQPPEHYEPSIXTEDLINKGSDFNXRPULEOZHUCBTLWXSNQTZBTETFPKZQTJQBYEBDNAFMXCNYPCWYYQWHSSOCBDHXZTMAZIBUS...

output:

37449596

result:

ok single line: '37449596'

Test #52:

score: 0
Accepted
time: 358ms
memory: 4256kb

input:

ZAVKTKUQPRYLTWTJCFXRLQHZVSGOLIVPPOOXSRAMUVVTORZLCIBMKPRGSBISNHAVGVPGFFSSBBWMLJBBUVCKOPQLMVNBFFDHJGTQVKGICQIWUMLFKJPXPZEXXBKSPBWXHFLHNGFISCEMJBLRPRCDPKHBIOHRTNSWYYDWXUPMNKMQIMSWLIUZJIJRIQBQOWJQRUHAZUSLGZDAEFVLHYLPHKLHUUVWBLZBPUDARSIWEANNHDSSIHPIBINQMGDNQBOLQWRURAZWLKDVHFCHXSVTMKPJGHMBFJEPZZHXPDVQYQZD...

output:

24231254

result:

ok single line: '24231254'

Test #53:

score: 0
Accepted
time: 2267ms
memory: 4260kb

input:

QPEEUFVTTONNZYXUXIZUSWQGEELIJPTOKNWLHBLEPFDNNFLJDUNBTATPMKIHRWVBILZVONKLEPXSYKPOEJSRHBDYZBDRHGYZNYBXTPKXCUPEITAXQDXXQRIDUCRNMBLZWUHSBFNNJMKUGXDVNUTXOHDFRPJJFZIBWMTDEQUSYWTRNHSZTHBTIZMCZKEJWFKNSBYAUFRZFSCMEYHBOGSDXJKIELQAMYTQJYYEANGRGHXTRNCYRKMLHLJBVMVVBFFTCLQHYOPTNIGMQIZXWSHZHUXROIUGYMYNCUWSUSAGPRUB...

output:

631309861

result:

ok single line: '631309861'

Test #54:

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

input:

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...

output:

1

result:

ok single line: '1'

Test #55:

score: 0
Accepted
time: 18ms
memory: 4320kb

input:

YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY...

output:

1250001

result:

ok single line: '1250001'

Test #56:

score: 0
Accepted
time: 39ms
memory: 4332kb

input:

DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

output:

235619534

result:

ok single line: '235619534'

Test #57:

score: 0
Accepted
time: 89ms
memory: 4352kb

input:

QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

output:

300860434

result:

ok single line: '300860434'

Test #58:

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

input:

UTTUUUUTTUUTTUTUTUTTUUUTUUTTUUUUTUTTUTTUUUUUUUUTUTUTUTUUUTUTUTUUTUUTUTTTUTUTUTUTUUTUUUTTUTUTTTTTUTTTUTTTTUTTTTTTTUUTTTTUTTUUTUUUUTUTTTTTTTUTTUTTUTTTTUUUUTUTUUUTTUTUUUTUUUUTUTUTUTUUUUUUUUTUTTTTTTTTTUUTUUTTTTUUUTUUTUTUTUUTUTTTUUUUUUTTTTUUUUUTTUUUTUUTUTTTTUTTTUTTTTUUUUTUUUUUUUUTUUTTTUUTTTTTUTTUTUTUTUUT...

output:

1

result:

ok single line: '1'

Test #59:

score: 0
Accepted
time: 40ms
memory: 4224kb

input:

PVVVPVPPPPVVPPVVPVVVPPVPPPPPPPVPPVPPPPPVVVVPPPVPPVVPPVPPVVPVVPPPVPVVVPPPVPVPPPPVPPPVVVVVVVPVPPVVVVPPPPVVVVPVVPPPPVPVPPPPPPPPVVPVPVVVPVVPVPPPVPPPPPPVPPVPPVVPPPPVVPPVVVPVVPPPVVPVVVVVPPVVVPVVPPPPPVVPPPVPPPVVPVPPPVVPVVPVPVPPPPPPPVPVVVVPVPVVPPPPPVPPPPVVPPVPPVPVPPPVPVPVPPPVVVPVPVVVVVVVVVVVPPVPVPVPVPVPVVVP...

output:

224949790

result:

ok single line: '224949790'

Test #60:

score: 0
Accepted
time: 240ms
memory: 4336kb

input:

YYYYYOOOOYYYYYYYYOOYYOYOOYOOYOYYOYYYOYYYYOYYOOOOOYOOYYYOOYYYOOYYYOOOYOYOOYYOOOYOOOYYYOOYOYOOOOYOYOOYOYYOYYYOOYYYYOYOYYYYOOYYYYOOOYYYYOYOOYYYOYYYYOYOOYOYOOYYOYYOYYOOYOYOYOOYOOYYYYYYYYOYYYYYOOOYOYOOYOOYYYYYOYYOYOOYOYOOOOYYYOYYYYYOYYYYYYOYYYYYOOYOYYOYYOYYYYYOYOYYYYOOYOOYOOOOYYOOOOOOOOOOYYYYYOYYOOOYOOOO...

output:

625319531

result:

ok single line: '625319531'

Test #61:

score: 0
Accepted
time: 1195ms
memory: 4332kb

input:

HHHWWHHHHHHHWHHWHWWHWHWHWWWWHWWHHWWWHHWHWWWHWWHWWWWWHWWWHHWHHWWWHWWWWHWWWHWHWHHWWHWWHHHHHHWHHWHWHWWWHWHHWWWWWWWWWHWHWWWWWHHHHHWHHHHWWWHWHHWWWHWWWHWWHHWHWWHWHHHWHHHWWHWHHWWWHWHWWWWWHHHWWWHWHWWWHHWWWWHHWHHHHWWWHWHHWWHHHWWWHHHHHWHWWWHHHHWHWHHWWHHHWHHHHWWWWHWHWWHHWHWHHHHWHWWHHWWHWHWWHWHWHWHHWHWHWWHHWHWH...

output:

365827857

result:

ok single line: '365827857'

Test #62:

score: 0
Accepted
time: 2273ms
memory: 4264kb

input:

NQUJDETQPGFBCEUNSQWSODOXMIHRXNGZSKIWJRVYVXYILYTRLKCNZMBWYDBDBZYEWWADZPKMHAWEQZYUNLYSOWCGAJVTVHWZRXDZOWURKINQWRPIQWNBDEBMHCNGRKCXTEWKPLYHIZBGHHUEJPFCXKJOHMREKSGFTLVGEPMPUXPVYGHHRSBSRDIPSXCZGCPQHSKLGIOEMBQDWRVLIWWRDHMYUPINOLSBLIGCNTASIPKGGEHKDGYOMFJPEPCLQAFUKSSBWLELYSCERLPNCTVXHZBYMABBGCWJUTELVFNEEKMI...

output:

649966991

result:

ok single line: '649966991'

Test #63:

score: 0
Accepted
time: 2271ms
memory: 4280kb

input:

DJIWPNLFBCWEOWDYAXBXIFLJOZIAXEPQWVACSOINDWIWDDVCXEDLAYQOKQHWEZLYHZAJSMDAJGSWSRSYVAZGQDWZWKXCSMRIUKVHXLPSIRYZLWIOJJQMQUJYENSUHLCJQIWHHQUQDGSQOPHPWYNCKMDMBVDJQWMUVWDCMBMLQWDNSBIATECADQKVMCEXEEKLZDVDXJTHLCSLMTVQRWWKUBTEZVONLYTOHZGYPMYJKRWCOUETVNQGJXZOWJTHVARWYZMNCABYWDROKIXKLTBRIKZQNQTAKXMMVDMHYSEHUQEU...

output:

115129530

result:

ok single line: '115129530'

Test #64:

score: 0
Accepted
time: 2274ms
memory: 4232kb

input:

QEDKBHKDMIVEVGNHDHQYMMLPJPLVJXTTWPWNRXPIJAFTLQRSSAAQYDZZIUYJOXAJCPVIPOOMAJELAGANTZBSEVHEJKTBNIFDLJZFMKKKRSMQZFROCIGCJILUBXJWLSHRBBCGTSAAGFWKDTNMTEEAOGXIGBNDEWXUJHNMXTARNAJZUISPOBAORIOKFWPQYTCTJRLTKLPPQZDBHQIQFRMKRDSVMWFNEORYFRYAMZARMUYQJSPHWWWVOLOIGNMSWQZGEBAQUZXUHUHCMOMPOCAPIXZJURPLAOVUPVVLULWAHLIR...

output:

968898966

result:

ok single line: '968898966'

Test #65:

score: 0
Accepted
time: 2279ms
memory: 4364kb

input:

JNQGBARFSPMAATGUSWZHTSYOILQYCFMKZAKZCBCLTVYMYYEBEUGLDISUEMDMPQQTJNBKFALXBSFVFCNZRYCWWMIHNZSEAGQBUVHMGRLNDHBJZEIGMETWHZJYEQEIYXDHOETKDGWBFAWVPOSGMNEYOZHQUCRJBEDOPQRMPHDQCBROFRAPWMOFVIDRNPKLLQWZDHXSOJNKGQTBRJWYOVZVOLCWQPBMTEVNVYJEUCJUBHGPMIIBSKBZFXABJPRXBLTJDSSKRMYCMAHOCPYQECNMAQUCBHFPBIXWZISXRHJTXSIS...

output:

598291130

result:

ok single line: '598291130'

Test #66:

score: 0
Accepted
time: 2273ms
memory: 4268kb

input:

MOWJYFPCZMRMEDPZMOQYSLQQUOEYPCWRNOFQGKCRZSFBMAVWFERTIOKKRJHHQYHOPAHJXEPTEUMEUPKYFNRCJGCWREKLNHNCSIEUPGLBJERJXZHQNRGGFFSMYJRVYCSVSQWSYRVFLNBQMQDIZIEQXTHKASYBNTLEXLPXUDTIVUSMXSAPHVGXICCQTAKVVJPHRWLDTFGORSOQGFESHBJWWZHVOCXJBNNDZFDKCKEXQDRFHSMVITKRBGACQUEZVVHKHRDSKNKEXAIHAMRVHXNDUKJZFDVQBSGYIPRKTFUHTMCX...

output:

2290417

result:

ok single line: '2290417'

Test #67:

score: 0
Accepted
time: 2273ms
memory: 4416kb

input:

FQFHKZICRAGBFAYJZAGWIWGVMNYBQYHGPLZONXZKQPSFDCDQGKWLZXSTNRISGUIESJOPLCOOMNEHOSHMTMQOTYLAOWBCOELFVDURQKHJAWKUUVMRAEQIZTYDQUTSJFWGRJOTJTRPUTWXYEKYSSKJFTXPTNFFEMHUOGIOXAQYIEAZDGFTQNCAFLACABYNRSYRSLWCBWBCFAVMBRIANITGGHFSETZWGXETIMSNTOAUQOEDONAGCJLDUYOOFIBQBTHKHOGJAEZJDJRGBGWSABSXHANEMTXWWONLFHNFBYMJKISK...

output:

393173949

result:

ok single line: '393173949'

Test #68:

score: 0
Accepted
time: 2273ms
memory: 4276kb

input:

GMRIRBFEZVNJPVJJRJNTDGKSPAUNSOQWYCBSFTZWMGYDKAXQULQIWCYSRDWVQEAGDZORHAGTNQKSXZEMRNDBWEOHTIJFFTFUKLHWWTHDBKOJBYQEERLFOLLDHMRIQOYZAANHGIVDKZPQBYWAAIYERVHYSEVFMWMRBEWXLEZZKMLDJTAKTLZLJDVPFWYUPZUNCXWOHBKPDWKYEEJHIBPUNPVFNYVZAPWNQNZEUPKOMMOHMHYROHIYHUYYOCEZSPSPKGVSGUSBTWJIKLMDSVZYVRQZWGTETZXWSZIRQAOKHWIW...

output:

998873577

result:

ok single line: '998873577'

Test #69:

score: 0
Accepted
time: 2283ms
memory: 4416kb

input:

SYDEMFQOXVKJARUUFLEDRXTACXPOHGIFHOHJKDEDLJIMARKWZZNQDMARYFFQTNGGJTJELDIVRTNPXBTUZALCTLGSYQGSKGIYQHPRGQJEIOYBJUODDMIOHAXSZJCBWIRMYGMDOVYPXRPFMYWFYWGGQKOAZKMFOHMSDPJAZTHXSWQDINRMSMLIPXAUPQVHZEIULDFQRYTZJTZSDPRKLMBINIBKGUOWZHLACHTXNDLZYTPMMJVTSYXFRNJFXDPBVSURTGGLQYRYYZPDLKGTMEQZHCTTXJWDWWSUTPOVRGZCYPHU...

output:

670688677

result:

ok single line: '670688677'

Test #70:

score: 0
Accepted
time: 2274ms
memory: 4352kb

input:

AITDWHYKOWZOHEFRMLGFERMWNMSUFTVLCEVPUGKBABIPCHLYDRFIZRNPQGHGSULBNYCDOEPNJACRKCZROCONMPEOWSENIAYOEFBMLTYJOHDFCEXPNWSXVCIPTERGKBMGXUDPRJWVKFAFISFGALXTBCVGEVDTQLXSBZUPQLIRLMMPRLKSZXPUDIAGYRKAAYFESZWDBXFIPSVEQTNPWVLNKUYUNFWANPMNAMVLBLZDKYGCGBGOMIMPDOUSFAQGKKOEQUDCMVFMDPFYTAHOVRQJDHRTNYNPVUXALGLOOVLMLHGT...

output:

760913752

result:

ok single line: '760913752'

Test #71:

score: 0
Accepted
time: 2270ms
memory: 4276kb

input:

ZFGHHBFQNXXBPPCKWPRYBVOQWIJTRCIYNNQDPNTUAYGHNYYAJJRDXZGXWOTDKUWQVVCMKSLODCRVPVTXCSTXUGJALQNIDJDHNWQUAUKSDFMFRVXXMACJSGHHZQORNKXDNKLWBTBUQIWCNFDOQXEVONCDWSDCGEHPLFXLREWYKMUGBAUEUQXVRTXYXVLFOEYXVVBNPBIXSWEUVIEILSMWCONPMNRRDIYWACNDWAVDGOELTJHHLGCLHKYDICBQXUNTOUGIJNVTDQNCVGEEQYDZWQOVWVTBFKPCUHULCUSYRMNA...

output:

530642847

result:

ok single line: '530642847'

Test #72:

score: 0
Accepted
time: 2274ms
memory: 4424kb

input:

NMWIXNKZTOWQJJAKJGNJNUIWKNCKUHDLRKTEFMBHFORUXWPMFIHXWLMCNEVCCYTEDCLGIRRZZJISDBOEUGKIGQMBMGLYKAOKZPAVMXBOXONNSXCSHLGISZFGRNVLFFJCXXVWRXMMYRLHJLYUKRAPGTRAIQNZFVRAJHYUPOAOICEAQDWKEXFQHNHEVBSVKLWCHCVMPEAGZPWVTNRYTNJYDUHFJIEJLSDKIRMEDONPMTVVARMSGORTZROHVIQIGNGTIDOYOHVTFSYUPBWFSUJPXLUEHOSFBOYIGPLITFCBFXTQ...

output:

206907775

result:

ok single line: '206907775'

Test #73:

score: 0
Accepted
time: 2268ms
memory: 4416kb

input:

VPBFLOASRWECUJYTRUROLLGIHZQOXXWAXBYNTJBWIRHZELSAOFTTXUCAAMYJFBRHLOPAKDCSGRMAJJJXOXJALHDZPGBBKKCXGVERFMNFPCELBAAUCUYCZKCMOHALIQGJHPXFZMSXPLLDPGQVAZPUAVYBNGMLSQZFEGGKEVWIRYSLITOLGVYYGXSFNMNZNJVBMJWTJIQIKYXEUXCHUSCOPHZWJRTWOSWHUEBXFTVBQPYXWHXWMOLBELEOVVNLNKACCBEGDIEAVEGSFXWMZLZRGVTVFIIKAUBRCQIKAXGMFLRY...

output:

842261451

result:

ok single line: '842261451'

Test #74:

score: 0
Accepted
time: 2273ms
memory: 4268kb

input:

WZBHEZRHNKOORUUPQTXXWURAYGYLJJOHWIHVIGOIZWDVNUTTNLYRWZUPPQCGZBUGYOHNXEXGAMQMUYDKXVHIBFYUBHOFGOAVOIHXBRXPUCJLIORSCHJUGKRGAZMYHBTMORPUKADYQMRKZIDQGOBHUCURYNNBNVQDHUDAFQULENJPQYEHXKLIUKCCYNVDXWHWJGPTSTZKJAAVSGUYYOGBADZZRWNRUDSEGMMRJMAPTDMTKRUEAPPQBYUAQUZTCPLEKDDTBAGBRRYTQHLSLNXOBFTBVTJGKPIAGGCIFRDKZVUW...

output:

502335191

result:

ok single line: '502335191'

Test #75:

score: 0
Accepted
time: 2427ms
memory: 4332kb

input:

OCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZL...

output:

433010414

result:

ok single line: '433010414'