QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#226625#3305. LCS 8IshyAC ✓1687ms4416kbC++143.1kb2023-10-26 11:15:262023-10-26 11:15:26

Judging History

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

  • [2023-10-26 11:15:26]
  • 评测
  • 测评结果:AC
  • 用时:1687ms
  • 内存:4416kb
  • [2023-10-26 11:15:26]
  • 提交

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][8][512], ans;
int now = 0, lst = 1;
// optimize
bool vis[26];
int _y, _T;
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);
		}
	}
	inline 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;
	}
	inline 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]);
		if(!vis[c - 'A']) _y = y, _T = T;
	}
}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);
		memset(vis, 0, sizeof(vis));
		for(int j = max(1, i - K); j <= min(n, i + K); ++j)
			vis[ch[j] - 'A'] = 1;
		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])
				{
					_y = -1;
					aya.Decode(i, x, S);
					for(int c = 0; c < 26; ++c)
					{
						if(!vis[c] && _y != -1)
						{
							Inc(f[now][_y][_T], f[lst][x][S]);
							continue;
						}
						aya.Trans(S, i, x, c + 'A');
					}
				}
	}
	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: 3832kb

input:

ACAYKP
0

output:

1

result:

ok single line: '1'

Test #2:

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

input:

CAPCAK
1

output:

896

result:

ok single line: '896'

Test #3:

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

input:

WEDONTNEEDNOEDUCATION
2

output:

24651976

result:

ok single line: '24651976'

Test #4:

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

input:

WEDONTNEEDNOTHOUGHTCONTROL
3

output:

224129308

result:

ok single line: '224129308'

Test #5:

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

input:

ACAYKP
3

output:

4789698

result:

ok single line: '4789698'

Test #6:

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

input:

CAPCAK
3

output:

4984867

result:

ok single line: '4984867'

Test #7:

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

input:

WEDONTNEEDNOEDUCATION
3

output:

22786993

result:

ok single line: '22786993'

Test #8:

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

input:

KAIST
3

output:

1384274

result:

ok single line: '1384274'

Test #9:

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

input:

A
0

output:

1

result:

ok single line: '1'

Test #10:

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

input:

B
1

output:

26

result:

ok single line: '26'

Test #11:

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

input:

C
2

output:

26

result:

ok single line: '26'

Test #12:

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

input:

D
3

output:

26

result:

ok single line: '26'

Test #13:

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

input:

RUN
2

output:

5409

result:

ok single line: '5409'

Test #14:

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

input:

PSUULHCWHL
0

output:

1

result:

ok single line: '1'

Test #15:

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

input:

OVASGWSKVN
1

output:

2492

result:

ok single line: '2492'

Test #16:

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

input:

LWUBHKTOPO
2

output:

1207903

result:

ok single line: '1207903'

Test #17:

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

input:

AJLOYNZOBR
3

output:

210748912

result:

ok single line: '210748912'

Test #18:

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

input:

BALEZEXVDLJG
0

output:

1

result:

ok single line: '1'

Test #19:

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

input:

PCCCZLAHEYJY
1

output:

2991

result:

ok single line: '2991'

Test #20:

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

input:

ZYXMMJAVCCQF
2

output:

1903794

result:

ok single line: '1903794'

Test #21:

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

input:

ZCMLLLZQSDOW
3

output:

425094268

result:

ok single line: '425094268'

Test #22:

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

input:

PHVAVJWOCJXCLR
0

output:

1

result:

ok single line: '1'

Test #23:

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

input:

JOLIGQVHOTGHKU
1

output:

4888

result:

ok single line: '4888'

Test #24:

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

input:

XOCAQTLVCOLTLX
2

output:

5030491

result:

ok single line: '5030491'

Test #25:

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

input:

KSYAUEQWAEGPFF
3

output:

621029949

result:

ok single line: '621029949'

Test #26:

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

input:

NUGTENEBJSHVHXKN
0

output:

1

result:

ok single line: '1'

Test #27:

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

input:

JWVPOVQZBMXOQLKM
1

output:

6386

result:

ok single line: '6386'

Test #28:

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

input:

QQLFOVJVMEQGOBHQ
2

output:

7757339

result:

ok single line: '7757339'

Test #29:

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

input:

OYINSEAHRIHHETJB
3

output:

936564349

result:

ok single line: '936564349'

Test #30:

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

input:

DCQMOZZSQVICIKGZLW
0

output:

1

result:

ok single line: '1'

Test #31:

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

input:

RTIXCFAPMOQPVFVWZO
1

output:

8083

result:

ok single line: '8083'

Test #32:

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

input:

EEIPKBRXDZRZYDJABN
2

output:

12831727

result:

ok single line: '12831727'

Test #33:

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

input:

CHMAUTTYYVIUEPFZSV
3

output:

271916449

result:

ok single line: '271916449'

Test #34:

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

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: 3820kb

input:

OXXGRYUWWPHDIDTAVFUI
2

output:

18069521

result:

ok single line: '18069521'

Test #37:

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

input:

ONBQZEBNLCGSWQJMLCSK
3

output:

679096242

result:

ok single line: '679096242'

Test #38:

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

input:

UUUUUUUUUU
0

output:

1

result:

ok single line: '1'

Test #39:

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

input:

LLLLLLLLLL
1

output:

251

result:

ok single line: '251'

Test #40:

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

input:

DDDDDDDDDD
2

output:

28376

result:

ok single line: '28376'

Test #41:

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

input:

RRRRRRRRRR
3

output:

1903376

result:

ok single line: '1903376'

Test #42:

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

input:

HQUWXLBTGTRUOODTQXRCFZHJONUEUDXUJSEVKIMEPLRWKWWQKCAQZSWHTOSBBEWTLNDOGYLDCPYTILRKAKHYVEWVHXIXVXCMMTCOVZCRDGCHZGCMJHOTFKHWRPLCAUMYFAILSNXBRXOIGMFOVXWXRQACPLMAKBOTCXECCDVRFPUGSDHLEQAEARIGMCLFQAJEFFLBSPLYVJHGLNWDMGGZPHVJLDVUJXAETWDJZPFNMKUOVAOYHEOMZDPQXHBCKPQLVYGWQHKZDFXKZXAPILWRDHDILBAELCQCRRSCRDIUCNRT...

output:

1

result:

ok single line: '1'

Test #43:

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

input:

RVRJTJQAVRCSAPFBDVGRMQEURXTLSTIYXITFBICIWIEEDXZNNNYULADHOWSYAICFFEAKZTNOKRXLYRAVAZXHYNZLDXISVFTETLEMNOTFYKVHEIEADSAEKOJMONKYMXPSKQOFSNDEBQMNNNXWESOLKZEHJNBHFFCISPDLKHACRIXJXASFPXEEMUOMEVOGWSWTGXQRSCULYYMUKQTOJKRUNECCPVYUVILYEGCEXUVROGMHAMFBRUETOZUVPATKONFOVCILIBIDYLDGIHTZQBZDEOUNUSNFWABZFOQRDXRMNIEB...

output:

68796748

result:

ok single line: '68796748'

Test #44:

score: 0
Accepted
time: 257ms
memory: 4404kb

input:

NISAPKXGGUZNNOKAVRLFFLMXUKKHALQZGLVGFTEZIJIGXSQNPPTQHUBKXNMTGNWCYKVIITRJOKVLGQCCAYVDBUWKNVNSJFQWGKPMURYGTVDPVLBWCNBAHTUNZWAXZVHPNSZVTDPMWEYHNGPFFANGPVSPVKKMUWRFHQDPAKVURHXYZXZXDDZTGBRQSBLHKMDNSTTYTJGQOLLJEFHXRFDTUWVXWDDGRQFGSREMZPREQLOONQKZZSEYAZRLKLYZIAGAZOODIQBHARPHFDRNMMCMVDKBOYQJLGBWVWFDKLIHUFOA...

output:

899592736

result:

ok single line: '899592736'

Test #45:

score: 0
Accepted
time: 1513ms
memory: 4412kb

input:

JPVAJPOTPZZRKSMHWUOGGARJFACLBXIFDCVCCRPFFRGBTLPOGTKLYDDQFLTSMNLLLXFIXDALVGFGBCGMRGDTGRYXFTNAVNTFWNWVQTJAKIKFQTIZHPBKJORQEYHRMZUTDHSWMBPEDRAVOIQLTCNYGJKSSBPKEKJCRIAYGLJJLYBRQJCHFYZRSGPUBZLPGSLCOCGQNZAPPVYDAVAFXNZLSZPUXCWPEENSZUZZKZILJAOXRSPIEZRZNOQLWAHKGFZKNKMAWFIYGNRWKGNZNEYMFKNEXFCPABIVPIFNDCIMTXUK...

output:

585665949

result:

ok single line: '585665949'

Test #46:

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

input:

YTXGIBVAGKTOEAOEFXKTEJZTFHJPIZSCGUCCQGHXSVAVQZBALZRPKNYPXLBIJZFXQUJNMCGZZJUWYNTZSKFXXTHVDKLJWSYALVVBBJLTYOAVFDFEFYIAVIEIQVRKZBSWWVOIXJKCGIIEZKAKWNEXTSUCBSFAFDKLITQRFIJMIITHYUJLFYHYPXNMZCQQTQYUDXXPBCJMTMHMPRJSSYGHYAXJYTIFPXNJIIWVCJVVLYXZMTFNZCFHHCNHXGRBHCOWACMCMNYCFPABMZIIXZONMPIDDRUKFGLYVKQTILJOOCGD...

output:

1

result:

ok single line: '1'

Test #47:

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

input:

LVNXQKLMVVWEDFSLSHDBLJMMJHJMBNIHMBLQVCNKUTYIZVQAHBFQVQTVKKZZXLZXIMPWXGTZPFUGABQFSACBXNSLGMQKWZCIOJBBNVFNEPTJVLYBVICUYCKIODBNRHRJAAVRORRHQYHBZUVCTFFGZQNYSQDCCVKPAEFKYIZNQJPEOIXOSJHPBYZZGUFNTVULEALKZZZMDURTWYIRXSXIAXCBBLHQTZRZTWPVLVKGGCYEUCFTWJSOLAKXLVBJSJDBNHIRKMEWQXKGJBCILOYYLFNDHUQGNDWRZUZBGJHQSLYG...

output:

54998437

result:

ok single line: '54998437'

Test #48:

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

input:

IUJKHOAKZJCMVZJYIOGRDREZQWDDRFPVSYTEYICNQYIVEXMTVRNBQSFFCWPGFWYLLQWHCOLBUNQMKGZWJPLTZZGHRHTIUJADFOBJMATZTEXJNKMYBYAHMNOMGEOCLAMGGDPPGRAMFJTWIVGVFLLHICSZSQWPTPOPJKIJFHIYLLMEUCYMSSLHTMUIYWRYRMQOEPZMLXADGUUBHEQTAFRLBRJNFAQVJAIIUYXVGFSCIAMUVMFLKXYTCZLJEOMUTNNFLEBLMMSYPKXERSKITEVAUVEEVPJQZLMTHVYSEBTQOWPI...

output:

965126013

result:

ok single line: '965126013'

Test #49:

score: 0
Accepted
time: 1510ms
memory: 4412kb

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: 40ms
memory: 4344kb

input:

RKKYDFZZHLHTXBJNYQQXRSXJSVANTQFMIAPZOVNCOVFJADLHBRIPGJKXZGFAANJIMGGFHPDUMIOJIXYVACYOYKXDNTJFQWLREFNMZZBCSTGGFWQBODBLNBKKMJJOKIVRCPFTVXLODGYFSNPRZMDIFWPAFPSDBCSISINJBIYTKAVBJAWNXFDQKXPMMXXVDILWFBESTLJZZYEVXQQPPEHYEPSIXTEDLINKGSDFNXRPULEOZHUCBTLWXSNQTZBTETFPKZQTJQBYEBDNAFMXCNYPCWYYQWHSSOCBDHXZTMAZIBUS...

output:

37449596

result:

ok single line: '37449596'

Test #52:

score: 0
Accepted
time: 258ms
memory: 4252kb

input:

ZAVKTKUQPRYLTWTJCFXRLQHZVSGOLIVPPOOXSRAMUVVTORZLCIBMKPRGSBISNHAVGVPGFFSSBBWMLJBBUVCKOPQLMVNBFFDHJGTQVKGICQIWUMLFKJPXPZEXXBKSPBWXHFLHNGFISCEMJBLRPRCDPKHBIOHRTNSWYYDWXUPMNKMQIMSWLIUZJIJRIQBQOWJQRUHAZUSLGZDAEFVLHYLPHKLHUUVWBLZBPUDARSIWEANNHDSSIHPIBINQMGDNQBOLQWRURAZWLKDVHFCHXSVTMKPJGHMBFJEPZZHXPDVQYQZD...

output:

24231254

result:

ok single line: '24231254'

Test #53:

score: 0
Accepted
time: 1521ms
memory: 4344kb

input:

QPEEUFVTTONNZYXUXIZUSWQGEELIJPTOKNWLHBLEPFDNNFLJDUNBTATPMKIHRWVBILZVONKLEPXSYKPOEJSRHBDYZBDRHGYZNYBXTPKXCUPEITAXQDXXQRIDUCRNMBLZWUHSBFNNJMKUGXDVNUTXOHDFRPJJFZIBWMTDEQUSYWTRNHSZTHBTIZMCZKEJWFKNSBYAUFRZFSCMEYHBOGSDXJKIELQAMYTQJYYEANGRGHXTRNCYRKMLHLJBVMVVBFFTCLQHYOPTNIGMQIZXWSHZHUXROIUGYMYNCUWSUSAGPRUB...

output:

631309861

result:

ok single line: '631309861'

Test #54:

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

input:

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...

output:

1

result:

ok single line: '1'

Test #55:

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

input:

YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY...

output:

1250001

result:

ok single line: '1250001'

Test #56:

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

input:

DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD...

output:

235619534

result:

ok single line: '235619534'

Test #57:

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

input:

QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ...

output:

300860434

result:

ok single line: '300860434'

Test #58:

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

input:

UTTUUUUTTUUTTUTUTUTTUUUTUUTTUUUUTUTTUTTUUUUUUUUTUTUTUTUUUTUTUTUUTUUTUTTTUTUTUTUTUUTUUUTTUTUTTTTTUTTTUTTTTUTTTTTTTUUTTTTUTTUUTUUUUTUTTTTTTTUTTUTTUTTTTUUUUTUTUUUTTUTUUUTUUUUTUTUTUTUUUUUUUUTUTTTTTTTTTUUTUUTTTTUUUTUUTUTUTUUTUTTTUUUUUUTTTTUUUUUTTUUUTUUTUTTTTUTTTUTTTTUUUUTUUUUUUUUTUUTTTUUTTTTTUTTUTUTUTUUT...

output:

1

result:

ok single line: '1'

Test #59:

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

input:

PVVVPVPPPPVVPPVVPVVVPPVPPPPPPPVPPVPPPPPVVVVPPPVPPVVPPVPPVVPVVPPPVPVVVPPPVPVPPPPVPPPVVVVVVVPVPPVVVVPPPPVVVVPVVPPPPVPVPPPPPPPPVVPVPVVVPVVPVPPPVPPPPPPVPPVPPVVPPPPVVPPVVVPVVPPPVVPVVVVVPPVVVPVVPPPPPVVPPPVPPPVVPVPPPVVPVVPVPVPPPPPPPVPVVVVPVPVVPPPPPVPPPPVVPPVPPVPVPPPVPVPVPPPVVVPVPVVVVVVVVVVVPPVPVPVPVPVPVVVP...

output:

224949790

result:

ok single line: '224949790'

Test #60:

score: 0
Accepted
time: 129ms
memory: 4404kb

input:

YYYYYOOOOYYYYYYYYOOYYOYOOYOOYOYYOYYYOYYYYOYYOOOOOYOOYYYOOYYYOOYYYOOOYOYOOYYOOOYOOOYYYOOYOYOOOOYOYOOYOYYOYYYOOYYYYOYOYYYYOOYYYYOOOYYYYOYOOYYYOYYYYOYOOYOYOOYYOYYOYYOOYOYOYOOYOOYYYYYYYYOYYYYYOOOYOYOOYOOYYYYYOYYOYOOYOYOOOOYYYOYYYYYOYYYYYYOYYYYYOOYOYYOYYOYYYYYOYOYYYYOOYOOYOOOOYYOOOOOOOOOOYYYYYOYYOOOYOOOO...

output:

625319531

result:

ok single line: '625319531'

Test #61:

score: 0
Accepted
time: 601ms
memory: 4412kb

input:

HHHWWHHHHHHHWHHWHWWHWHWHWWWWHWWHHWWWHHWHWWWHWWHWWWWWHWWWHHWHHWWWHWWWWHWWWHWHWHHWWHWWHHHHHHWHHWHWHWWWHWHHWWWWWWWWWHWHWWWWWHHHHHWHHHHWWWHWHHWWWHWWWHWWHHWHWWHWHHHWHHHWWHWHHWWWHWHWWWWWHHHWWWHWHWWWHHWWWWHHWHHHHWWWHWHHWWHHHWWWHHHHHWHWWWHHHHWHWHHWWHHHWHHHHWWWWHWHWWHHWHWHHHHWHWWHHWWHWHWWHWHWHWHHWHWHWWHHWHWH...

output:

365827857

result:

ok single line: '365827857'

Test #62:

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

input:

NQUJDETQPGFBCEUNSQWSODOXMIHRXNGZSKIWJRVYVXYILYTRLKCNZMBWYDBDBZYEWWADZPKMHAWEQZYUNLYSOWCGAJVTVHWZRXDZOWURKINQWRPIQWNBDEBMHCNGRKCXTEWKPLYHIZBGHHUEJPFCXKJOHMREKSGFTLVGEPMPUXPVYGHHRSBSRDIPSXCZGCPQHSKLGIOEMBQDWRVLIWWRDHMYUPINOLSBLIGCNTASIPKGGEHKDGYOMFJPEPCLQAFUKSSBWLELYSCERLPNCTVXHZBYMABBGCWJUTELVFNEEKMI...

output:

649966991

result:

ok single line: '649966991'

Test #63:

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

input:

DJIWPNLFBCWEOWDYAXBXIFLJOZIAXEPQWVACSOINDWIWDDVCXEDLAYQOKQHWEZLYHZAJSMDAJGSWSRSYVAZGQDWZWKXCSMRIUKVHXLPSIRYZLWIOJJQMQUJYENSUHLCJQIWHHQUQDGSQOPHPWYNCKMDMBVDJQWMUVWDCMBMLQWDNSBIATECADQKVMCEXEEKLZDVDXJTHLCSLMTVQRWWKUBTEZVONLYTOHZGYPMYJKRWCOUETVNQGJXZOWJTHVARWYZMNCABYWDROKIXKLTBRIKZQNQTAKXMMVDMHYSEHUQEU...

output:

115129530

result:

ok single line: '115129530'

Test #64:

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

input:

QEDKBHKDMIVEVGNHDHQYMMLPJPLVJXTTWPWNRXPIJAFTLQRSSAAQYDZZIUYJOXAJCPVIPOOMAJELAGANTZBSEVHEJKTBNIFDLJZFMKKKRSMQZFROCIGCJILUBXJWLSHRBBCGTSAAGFWKDTNMTEEAOGXIGBNDEWXUJHNMXTARNAJZUISPOBAORIOKFWPQYTCTJRLTKLPPQZDBHQIQFRMKRDSVMWFNEORYFRYAMZARMUYQJSPHWWWVOLOIGNMSWQZGEBAQUZXUHUHCMOMPOCAPIXZJURPLAOVUPVVLULWAHLIR...

output:

968898966

result:

ok single line: '968898966'

Test #65:

score: 0
Accepted
time: 1515ms
memory: 4340kb

input:

JNQGBARFSPMAATGUSWZHTSYOILQYCFMKZAKZCBCLTVYMYYEBEUGLDISUEMDMPQQTJNBKFALXBSFVFCNZRYCWWMIHNZSEAGQBUVHMGRLNDHBJZEIGMETWHZJYEQEIYXDHOETKDGWBFAWVPOSGMNEYOZHQUCRJBEDOPQRMPHDQCBROFRAPWMOFVIDRNPKLLQWZDHXSOJNKGQTBRJWYOVZVOLCWQPBMTEVNVYJEUCJUBHGPMIIBSKBZFXABJPRXBLTJDSSKRMYCMAHOCPYQECNMAQUCBHFPBIXWZISXRHJTXSIS...

output:

598291130

result:

ok single line: '598291130'

Test #66:

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

input:

MOWJYFPCZMRMEDPZMOQYSLQQUOEYPCWRNOFQGKCRZSFBMAVWFERTIOKKRJHHQYHOPAHJXEPTEUMEUPKYFNRCJGCWREKLNHNCSIEUPGLBJERJXZHQNRGGFFSMYJRVYCSVSQWSYRVFLNBQMQDIZIEQXTHKASYBNTLEXLPXUDTIVUSMXSAPHVGXICCQTAKVVJPHRWLDTFGORSOQGFESHBJWWZHVOCXJBNNDZFDKCKEXQDRFHSMVITKRBGACQUEZVVHKHRDSKNKEXAIHAMRVHXNDUKJZFDVQBSGYIPRKTFUHTMCX...

output:

2290417

result:

ok single line: '2290417'

Test #67:

score: 0
Accepted
time: 1518ms
memory: 4384kb

input:

FQFHKZICRAGBFAYJZAGWIWGVMNYBQYHGPLZONXZKQPSFDCDQGKWLZXSTNRISGUIESJOPLCOOMNEHOSHMTMQOTYLAOWBCOELFVDURQKHJAWKUUVMRAEQIZTYDQUTSJFWGRJOTJTRPUTWXYEKYSSKJFTXPTNFFEMHUOGIOXAQYIEAZDGFTQNCAFLACABYNRSYRSLWCBWBCFAVMBRIANITGGHFSETZWGXETIMSNTOAUQOEDONAGCJLDUYOOFIBQBTHKHOGJAEZJDJRGBGWSABSXHANEMTXWWONLFHNFBYMJKISK...

output:

393173949

result:

ok single line: '393173949'

Test #68:

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

input:

GMRIRBFEZVNJPVJJRJNTDGKSPAUNSOQWYCBSFTZWMGYDKAXQULQIWCYSRDWVQEAGDZORHAGTNQKSXZEMRNDBWEOHTIJFFTFUKLHWWTHDBKOJBYQEERLFOLLDHMRIQOYZAANHGIVDKZPQBYWAAIYERVHYSEVFMWMRBEWXLEZZKMLDJTAKTLZLJDVPFWYUPZUNCXWOHBKPDWKYEEJHIBPUNPVFNYVZAPWNQNZEUPKOMMOHMHYROHIYHUYYOCEZSPSPKGVSGUSBTWJIKLMDSVZYVRQZWGTETZXWSZIRQAOKHWIW...

output:

998873577

result:

ok single line: '998873577'

Test #69:

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

input:

SYDEMFQOXVKJARUUFLEDRXTACXPOHGIFHOHJKDEDLJIMARKWZZNQDMARYFFQTNGGJTJELDIVRTNPXBTUZALCTLGSYQGSKGIYQHPRGQJEIOYBJUODDMIOHAXSZJCBWIRMYGMDOVYPXRPFMYWFYWGGQKOAZKMFOHMSDPJAZTHXSWQDINRMSMLIPXAUPQVHZEIULDFQRYTZJTZSDPRKLMBINIBKGUOWZHLACHTXNDLZYTPMMJVTSYXFRNJFXDPBVSURTGGLQYRYYZPDLKGTMEQZHCTTXJWDWWSUTPOVRGZCYPHU...

output:

670688677

result:

ok single line: '670688677'

Test #70:

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

input:

AITDWHYKOWZOHEFRMLGFERMWNMSUFTVLCEVPUGKBABIPCHLYDRFIZRNPQGHGSULBNYCDOEPNJACRKCZROCONMPEOWSENIAYOEFBMLTYJOHDFCEXPNWSXVCIPTERGKBMGXUDPRJWVKFAFISFGALXTBCVGEVDTQLXSBZUPQLIRLMMPRLKSZXPUDIAGYRKAAYFESZWDBXFIPSVEQTNPWVLNKUYUNFWANPMNAMVLBLZDKYGCGBGOMIMPDOUSFAQGKKOEQUDCMVFMDPFYTAHOVRQJDHRTNYNPVUXALGLOOVLMLHGT...

output:

760913752

result:

ok single line: '760913752'

Test #71:

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

input:

ZFGHHBFQNXXBPPCKWPRYBVOQWIJTRCIYNNQDPNTUAYGHNYYAJJRDXZGXWOTDKUWQVVCMKSLODCRVPVTXCSTXUGJALQNIDJDHNWQUAUKSDFMFRVXXMACJSGHHZQORNKXDNKLWBTBUQIWCNFDOQXEVONCDWSDCGEHPLFXLREWYKMUGBAUEUQXVRTXYXVLFOEYXVVBNPBIXSWEUVIEILSMWCONPMNRRDIYWACNDWAVDGOELTJHHLGCLHKYDICBQXUNTOUGIJNVTDQNCVGEEQYDZWQOVWVTBFKPCUHULCUSYRMNA...

output:

530642847

result:

ok single line: '530642847'

Test #72:

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

input:

NMWIXNKZTOWQJJAKJGNJNUIWKNCKUHDLRKTEFMBHFORUXWPMFIHXWLMCNEVCCYTEDCLGIRRZZJISDBOEUGKIGQMBMGLYKAOKZPAVMXBOXONNSXCSHLGISZFGRNVLFFJCXXVWRXMMYRLHJLYUKRAPGTRAIQNZFVRAJHYUPOAOICEAQDWKEXFQHNHEVBSVKLWCHCVMPEAGZPWVTNRYTNJYDUHFJIEJLSDKIRMEDONPMTVVARMSGORTZROHVIQIGNGTIDOYOHVTFSYUPBWFSUJPXLUEHOSFBOYIGPLITFCBFXTQ...

output:

206907775

result:

ok single line: '206907775'

Test #73:

score: 0
Accepted
time: 1507ms
memory: 4360kb

input:

VPBFLOASRWECUJYTRUROLLGIHZQOXXWAXBYNTJBWIRHZELSAOFTTXUCAAMYJFBRHLOPAKDCSGRMAJJJXOXJALHDZPGBBKKCXGVERFMNFPCELBAAUCUYCZKCMOHALIQGJHPXFZMSXPLLDPGQVAZPUAVYBNGMLSQZFEGGKEVWIRYSLITOLGVYYGXSFNMNZNJVBMJWTJIQIKYXEUXCHUSCOPHZWJRTWOSWHUEBXFTVBQPYXWHXWMOLBELEOVVNLNKACCBEGDIEAVEGSFXWMZLZRGVTVFIIKAUBRCQIKAXGMFLRY...

output:

842261451

result:

ok single line: '842261451'

Test #74:

score: 0
Accepted
time: 1513ms
memory: 4340kb

input:

WZBHEZRHNKOORUUPQTXXWURAYGYLJJOHWIHVIGOIZWDVNUTTNLYRWZUPPQCGZBUGYOHNXEXGAMQMUYDKXVHIBFYUBHOFGOAVOIHXBRXPUCJLIORSCHJUGKRGAZMYHBTMORPUKADYQMRKZIDQGOBHUCURYNNBNVQDHUDAFQULENJPQYEHXKLIUKCCYNVDXWHWJGPTSTZKJAAVSGUYYOGBADZZRWNRUDSEGMMRJMAPTDMTKRUEAPPQBYUAQUZTCPLEKDDTBAGBRRYTQHLSLNXOBFTBVTJGKPIAGGCIFRDKZVUW...

output:

502335191

result:

ok single line: '502335191'

Test #75:

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

input:

OCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZLPNQJDGRMFAYBOCKETSIHWVXUZL...

output:

433010414

result:

ok single line: '433010414'