QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#715265#6197. 太阳神的宴会NineSuns22 40ms100656kbC++141.6kb2024-11-06 11:10:152024-11-06 11:10:15

Judging History

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

  • [2024-11-06 11:10:15]
  • 评测
  • 测评结果:22
  • 用时:40ms
  • 内存:100656kb
  • [2024-11-06 11:10:15]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define pii pair <int, int>
#define fi first
#define se second
#define pb push_back
#define ull unsigned long long

using namespace std;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e6+5, mod = 998244353; 
int n, tot, k, f[N], id[N]; 
map <int, int> ch[N]; 
vector <int> las[N]; 
ll lv[26];  
int pre[26]; 
struct trie {
	int rt;  
	ll sm, sn; 
	void ins (string s, int l) {
		int p = rt;
		memset(pre, -1, sizeof pre);  
		for (int i = l;i < s.size();i++) {
			int x; 
			if (~pre[s[i]-'a']) {
				x = i-pre[s[i]-'a']; 
			}
			else x = 0; 
			pre[s[i]-'a'] = i; 
			if (ch[p].count(x)) p = ch[p][x]; 
			else {
				ch[p][x] = ++tot; p = tot; 
			}
		}
	}
	void dfs (int p, int x) {
		(sm += lv[x]) %= mod;
		if (!ch[p].count(0)) (sn += lv[x]*(k-ch[p].size()))%mod;  
		else (sn += lv[x]*(k-x-ch[p].size()))%mod; 
//		cout << p << " " << x << " " << endl; 
		for (auto i : ch[p]) dfs(i.se, x+(i.fi == 0)); 
	}
}tr[N];

string str; 
void solve () {
	cin >> n >> k; 
	lv[0] = 1; for (int i = 1;i < k;i++) lv[i] = lv[i-1]*(k-i)%mod; 	
	for (int i = 1;i <= n;i++) {
		int las = tot; 
		tr[i].rt = ++tot; 
		cin >> str; 
		for (int j = 0;j < str.size();j++) tr[i].ins(str, j); 
		tr[i].dfs(tr[i].rt+1, 0); 
	}
//	cout << "CASE\n"; 
	ll s = k, ans = 0; 
	for (int i = 1;i <= n;i++) {
		(ans += s*tr[i].sm) %= mod; 
//		cout << s << " " << tr[i].sm << endl;  
		s = s*tr[i].sn%mod;  
	}
	cout << (ans+1)%mod; 
}

signed main () {
//	ios::sync_with_stdio(0);
//	cin.tie(0); cout.tie(0);
	int T = 1;
	while (T--) solve();
	return 0;
}


详细

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 20ms
memory: 98308kb

input:

1 2
bbbaabbbbbaabaabbababbabbaaabbaaabaaabbabbabbbaaabaababbbaabbbabaaaaabbbbbabbabbbbbabbaababaabbbababbbbabababbaabbbbabbbababbbaabaabbabbbbababaabbbbbabaaaaaabbbbbbbaaaaabbabbbbaaabaaabaababbbababaaaabbababaaabbababaabbbbaabababbbabbabaababbbabaababaaabaaabaaababaaaaabbaaaaabbabaababbababbbbbaaba...

output:

981227

result:

ok 1 number(s): "981227"

Test #2:

score: 2
Accepted
time: 36ms
memory: 98512kb

input:

1 2
abaabbababaaabbbabaaabbaabbbbaaabbbbbbaabbababbabbbbbbaaabbabbaabbbbbaababbaabbabababaaaaabaaabbbbaaaaabaababbbbaaabbabbaabaabaaabbbabaaaababbabbbaabbbaaabbbabbbbaaabbbbbababbababaaaaababbabbbbbbababbaabaaaabaaabaabbabbaabbbabababbbaabababaaaaabbbaaabaabaabbbaababaaabbbbabbbbbabaababbabbbaababab...

output:

981457

result:

ok 1 number(s): "981457"

Test #3:

score: 2
Accepted
time: 36ms
memory: 100408kb

input:

1 2
aaaaaababbbaabaaaabbaababbabaaabbbbbaabbababaaaabaabaabaaaabaababbaababbabbabbbaaaaaaabaabbaaaabaabaaaabaabbbabbaaababbbaaaabbbbababbbaaabbabbbababbbbbbbababbaaaabbbbbabbabbaabaaabaaaabbababbbaabbbbaababbbabbaababaabaaabaaaaaaaabaaabaaababaababbbababababbbbaababababbabbbbabaaaaababbbbabaaabbbabb...

output:

981717

result:

ok 1 number(s): "981717"

Test #4:

score: 2
Accepted
time: 23ms
memory: 88164kb

input:

1 2
abbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

549593

result:

ok 1 number(s): "549593"

Test #5:

score: 2
Accepted
time: 8ms
memory: 75496kb

input:

1 2
babbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

5989

result:

ok 1 number(s): "5989"

Test #6:

score: 2
Accepted
time: 11ms
memory: 75396kb

input:

1 2
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

3997

result:

ok 1 number(s): "3997"

Test #7:

score: 2
Accepted
time: 15ms
memory: 77632kb

input:

1 2
abbaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaaba...

output:

11949

result:

ok 1 number(s): "11949"

Test #8:

score: 2
Accepted
time: 19ms
memory: 82436kb

input:

1 2
baabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbabbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaa...

output:

298323

result:

ok 1 number(s): "298323"

Test #9:

score: 2
Accepted
time: 12ms
memory: 77572kb

input:

1 2
bababbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbba...

output:

11947

result:

ok 1 number(s): "11947"

Subtask #2:

score: 7
Accepted

Dependency #1:

100%
Accepted

Test #10:

score: 7
Accepted
time: 27ms
memory: 100556kb

input:

1 5
badaeeaadaacedaaaabeabcabbcdbeadcabbaeaaabbdeecbdecaeaecceabebcddbdaaabddeadaeebebbcdcaedcacbaccdabeeeccbaebbadbdeabcbcdbccecacbecccadebbbdcacdcabdadaccadbaccbecdcccbbdbaaebeeabbdcbbeaadebecaccdcaeceabeaadbdecbecdbcccceabdaabcbaaeccbdebceeeeddceababaecabadeabaadeaabcbaaaabbcbcabcebdaebcbedcccaea...

output:

59251641

result:

ok 1 number(s): "59251641"

Test #11:

score: 7
Accepted
time: 28ms
memory: 100656kb

input:

1 5
bdbdcdaeaedaecdeccbdcdecaaeeeaeadcbcdbadcdcdeddbdccbdbddadcecbbdabeabbbecdddbacabebdecbacbbcaebdddbbadbccecacaecbebeecadeceaeecbbdecbdeacdecabbecaaedddddcbbecebcaebaeeeedecdcbaaacedaedacaaaaaceeaacedecbdbeacecbbaccdecbecccaeedecdbbecbdcbaababedeecaeeaaacebadbadbddaedcccbdbdeabcbbdbeddbbacdbaaade...

output:

59257546

result:

ok 1 number(s): "59257546"

Test #12:

score: 7
Accepted
time: 14ms
memory: 100500kb

input:

1 5
bbdbedabdeccedeabccabebccbaaeccceadabebabbebcbbbebbdcbadadcdaacdacbdedaeaaedaddcdeeadebcdedcbcabeaccdcbeececdbaadddcdbadcceeecdaebeaebabdbbadaaddededbcdccacbebcebadcdbcbddbacecaadbcaecebebbcdcceabbeebedcbbccdebcdbaaecebdcdeeecaccacbeebaabbcdcabecaddaddcbaaeeaadacababbdedcbecabaabadabedeeeacceddd...

output:

59256626

result:

ok 1 number(s): "59256626"

Test #13:

score: 7
Accepted
time: 23ms
memory: 91444kb

input:

1 5
edacbddddddddddddddddddddddddddddddddddddddddddcdddddddddddddddddddddddddddddddddddddddddddddbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

11796771

result:

ok 1 number(s): "11796771"

Test #14:

score: 7
Accepted
time: 26ms
memory: 95280kb

input:

1 5
abdecaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

43297081

result:

ok 1 number(s): "43297081"

Test #15:

score: 7
Accepted
time: 34ms
memory: 89572kb

input:

1 5
aebdcaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

15014801

result:

ok 1 number(s): "15014801"

Test #16:

score: 7
Accepted
time: 24ms
memory: 94764kb

input:

1 5
ecabddecdacdbdeccacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacebdecdacebdecdacdbdecdacdbaecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdeceacdbdecdacdbdecdacdbdecdacdbdecdccdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbaecdacdbdecdacdbdecdacdbddc...

output:

49679211

result:

ok 1 number(s): "49679211"

Test #17:

score: 7
Accepted
time: 20ms
memory: 90836kb

input:

1 5
ebacdeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeea...

output:

27506986

result:

ok 1 number(s): "27506986"

Test #18:

score: 7
Accepted
time: 26ms
memory: 92460kb

input:

1 5
dbceadaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdac...

output:

43950531

result:

ok 1 number(s): "43950531"

Test #19:

score: 7
Accepted
time: 28ms
memory: 100404kb

input:

1 26
ffdczbkzlrnevxxhowxmtgagaveotvbgrhayxfsrqlmocrzkchduecjvobzrxywdsgazytypvkrrqxdacxomcbvuhmnesdokjnniozcfscbenlimgfwwypyhrezpojeggkecyyeopaxprmistdqmntvirniwdgeliokjhctmheqnaslhklzbkiacnocjkwrtmcaklusxwyuwohjptwanouyofqncrmtdzqqvexnncdfxrorxiuvhpgcxwfrkyljehpnjbxwqngwximxhfrcvrzzapkmftgtuhvrdatc...

output:

882426059

result:

ok 1 number(s): "882426059"

Test #20:

score: 7
Accepted
time: 32ms
memory: 98252kb

input:

1 26
emuojkmxgrmwudjwtfpxhgxolynqirqyapyelmsnjqzuqvcxaoqvahvckhepjxsguxhxxnldmoarnmwiyfjcxygxftnbfipxtnuhihgbqgirnlevejfxqlrezeilomrzzkfogyoxhjbaafbnprtjvbvlriunczycqhkdgexgwgespztrwtvkdauhnhhljbzszjvmedekmvlfmcypdpudjpxhyyrramiktudbpjulxsavodfoogcknnommsuqogdauwxblylalmyrgstcoqweiefaquniexecvdkdeqy...

output:

156353466

result:

ok 1 number(s): "156353466"

Test #21:

score: 7
Accepted
time: 32ms
memory: 98292kb

input:

1 26
poyxnmficghjoxsikwykahamerquhetfjlqfvuckdectveczvcafbzgsiufcvkoiwhkxxnunazcolhpddrujbpsjiwlmddbmvhwwdmqpxokguvdwsbbepuwctanpnzdrmndwwkaszptyzomoqttfdactflqmpsguvhbpeozdpbnuiesiyjctdfpxzfrchqfsfvtcdxzkjuegabsdfdbxyfbgoifgvzutpgfgqoztgzqsgbctslaqgvnhihqshhugnvtgzkeepntozvenzxgsveimqztfpjbruiondat...

output:

866443096

result:

ok 1 number(s): "866443096"

Test #22:

score: 7
Accepted
time: 34ms
memory: 91876kb

input:

1 26
aqdhpubwvnejxokrzisfgclmtyrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrjrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrurrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr...

output:

183682092

result:

ok 1 number(s): "183682092"

Test #23:

score: 7
Accepted
time: 24ms
memory: 86856kb

input:

1 26
ivnhpozdtbsrqlckjxgymafuewddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

65304226

result:

ok 1 number(s): "65304226"

Test #24:

score: 7
Accepted
time: 35ms
memory: 96824kb

input:

1 26
yutwpfoljxnksdaqmegvhrizcbddddddddddddddddddddddddddddddddddddddddddddqdddddddddddddddudddgddddddddddddddddddddhddwdtdddddddddjdddddddddddddddddddddddddddddddddddddddcdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddrdddddddddddddddddddddmdddddddddddddddddddddddddddddddddddddddd...

output:

558163738

result:

ok 1 number(s): "558163738"

Test #25:

score: 7
Accepted
time: 32ms
memory: 97596kb

input:

1 26
khzuplhdboqareginmstkwjufvcfugzeewcbciugzeewcbcfugznempbckugheewclcfugzeewcbqfugzeeqcbcfugzeewcbcfugzeewcbcfugzdewcbcbugzeewcbcfugzeewcbcfugzeewcbcfugzeowcbcfugzeewcbcfugzeewcbcfugzeewcbcfugzeewcxcfugzeewcbcfugzeewcbcfugzeewcbcfugzecwcbcfugzeewcbcfugzeewcbcfugzcewcbcfugzeewcscfugzeewcfcfugzeewc...

output:

254733399

result:

ok 1 number(s): "254733399"

Test #26:

score: 7
Accepted
time: 40ms
memory: 99192kb

input:

1 26
hciwgbknurqstjdmpezjfvoxayajyoajlwunajyodjkwunajyoajkwunajyoejkwunaoyoajkwunajyoajkwunajydajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyoajkwufajyoajpwunajyoajkwunajyoajkwunajyoajkwunajyoajkwunajyopjkwunajyoajkwunajyoajkwunajyoajkwu...

output:

31112975

result:

ok 1 number(s): "31112975"

Test #27:

score: 7
Accepted
time: 16ms
memory: 94852kb

input:

1 26
amxhcdorjkpedsulwytifnrbqzcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbebcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc...

output:

546199686

result:

ok 1 number(s): "546199686"

Subtask #3:

score: 0
Runtime Error

Dependency #2:

100%
Accepted

Test #28:

score: 0
Runtime Error

input:

1 5
ccaacbebeeedcdebbcccbbddeddbaceaacccaccbeaaedecadabbbbebbecdebeaacceabdaedccddddcdabecbddccaacbbbbecacdbddedcbbbecaaddccaeeabdadebaeacebebeabbbebbcbaacbeeebbbaacacaaddecdabdbdbbaabeeeddecabbaaceaabcdcabaadaccdcebdedbdbacedbceceaabcaebdaeabbbdbdcaeacdbadecbdcabdbaaebecdcdcdaaceaaecdebcaddebbdacda...

output:


result:


Subtask #4:

score: 13
Accepted

Dependency #1:

100%
Accepted

Test #46:

score: 13
Accepted
time: 36ms
memory: 100244kb

input:

2 2
aaababbabaaaabbaababbbaaabbbbbbbaababbbbbbbabbabbabbbbbbababbabbaababbbbbbbabaaaabbbababbbbabaabbaabbaaaaaaabaaababbaabbbabababababaaabbababaaabbaababaabbbaababaaaaaaabbaaababbaaabaabbaaaabaabbabaaabbbbbabaaabababababbaabaabbbabbaabaaabbababbbabaabbbabbbbaababbaabbabbbabababaaabaabbaaabbabababab...

output:

1959299

result:

ok 1 number(s): "1959299"

Test #47:

score: 13
Accepted
time: 22ms
memory: 98432kb

input:

2 2
bbaaababbbbbbbaabaaabbabbabbbbaabbabaaabababaaabbbbbababbbaaaababbabaaabaabbaaaabababaaabaaaaaaabaaabbbaabaaabbabbbabbbbaaaaaabaaabbbabbabbaabbbabaabaaaaabbbabbbabaabbbbbbababbabbabbbbbaaaaaabaabaaaaaabbabaabbaaabbbbabababbabbababbabaabbbabbbabbbbabbbababaabbabbabaaabaabbaaaaaabaabbbbabbbbababab...

output:

2932325

result:

ok 1 number(s): "2932325"

Test #48:

score: 13
Accepted
time: 33ms
memory: 100436kb

input:

2 2
bbbabaaaaabaabaabbaaaabababaabbababbbbbbaaaababbbbbbbbaaaaabbaaababbbaababaaababbabaaabaabbbabbababbabbabababbbbbbabbbbababbbaabbabaaaaababbaaabababbabaabbaaaabaaabaabbaabbabbabaaabbaaaaabbabaaaabaabbbababbabbbaabababbabbbbbbabbbababbbabbaaaaaabababababbaabbbbbaabbaaaabbaaababaaaabaabababaabbaaa...

output:

2932847

result:

ok 1 number(s): "2932847"

Test #49:

score: 13
Accepted
time: 20ms
memory: 87008kb

input:

2 2
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

998023

result:

ok 1 number(s): "998023"

Test #50:

score: 13
Accepted
time: 16ms
memory: 83260kb

input:

2 2
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1026221

result:

ok 1 number(s): "1026221"

Test #51:

score: 13
Accepted
time: 20ms
memory: 88120kb

input:

2 2
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1372091

result:

ok 1 number(s): "1372091"

Test #52:

score: 13
Accepted
time: 8ms
memory: 75444kb

input:

2 2
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

7987

result:

ok 1 number(s): "7987"

Test #53:

score: 13
Accepted
time: 15ms
memory: 78292kb

input:

2 2
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

364637

result:

ok 1 number(s): "364637"

Test #54:

score: 13
Accepted
time: 12ms
memory: 75756kb

input:

2 2
abaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbb...

output:

59441

result:

ok 1 number(s): "59441"

Test #55:

score: 13
Accepted
time: 32ms
memory: 98988kb

input:

31 2
ababbabbbabbbbbaababbaaaabbbbabaaaabbabaabaaaabbbabbbabbbbabbbababaaaaabbbaababbabbabaaaabbaaaaabbabbaaabbaaaabbbaabbbbbbaaaababbabaaabaaabaabbbabaabbaaaaabbbaaaabbbbbbaaabbbaabbabaababaaabbabaaaaabbbbbaaabababaaaabbbbaabaabbbbbaabbabbbaababaabbbabbababaaaabbbababbbabbbbaaababaaaabaaaaaaaababaa...

output:

720427737

result:

ok 1 number(s): "720427737"

Test #56:

score: 13
Accepted
time: 30ms
memory: 95548kb

input:

31 2
aababaaaaabaaaabaaabbabbabaabbaaaaabbababbbbababaabbaaabaaaaabbbbabaabbbababaaababaaabaaaabbbaaababaabbbbabaabbabaababbaabaaaaababaabbbbaaababaaaabbbbababbbaaaaabbbbbaabbabbabbbaaabbbabaabaaabaaaabbbbbabbaababbbababbaaaabbaaaaaaababbabbbbbbabbaabbbbababababbbabbbbaaabbbaaaabbabbaaaaabaabaaaaaaa...

output:

571807039

result:

ok 1 number(s): "571807039"

Test #57:

score: 13
Accepted
time: 15ms
memory: 85420kb

input:

31 2
ababbaabbaabbbbaaaabbbbbaaaaabaabaaaaaaaabbbbaabbbbbbbbabaabbabaabbbabbbaaabbbbabaaaaaabbbbbbabbbbbbaababbabbabaaaaaabbaaababbaabbabbbabbbabaaaabaabbabbbbaaabbabbabbaabbabaabbabaaaabaabbabababaabbaaababababbaabaabaaabaaababbaaababaabaabbabbbbbbbbbbbaababaaaabbabbbbababbbbabbaababbbbaabbbaabbaba...

output:

325715314

result:

ok 1 number(s): "325715314"

Test #58:

score: 13
Accepted
time: 17ms
memory: 82880kb

input:

31 2
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

788272657

result:

ok 1 number(s): "788272657"

Test #59:

score: 13
Accepted
time: 12ms
memory: 75396kb

input:

31 2
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

830805666

result:

ok 1 number(s): "830805666"

Test #60:

score: 13
Accepted
time: 10ms
memory: 82796kb

input:

31 2
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

744200473

result:

ok 1 number(s): "744200473"

Test #61:

score: 13
Accepted
time: 19ms
memory: 85676kb

input:

31 2
baabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaa...

output:

351845541

result:

ok 1 number(s): "351845541"

Test #62:

score: 13
Accepted
time: 16ms
memory: 75792kb

input:

31 2
ababaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbaba...

output:

400428613

result:

ok 1 number(s): "400428613"

Test #63:

score: 13
Accepted
time: 17ms
memory: 81932kb

input:

31 2
abaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaa...

output:

328678714

result:

ok 1 number(s): "328678714"

Test #64:

score: 13
Accepted
time: 11ms
memory: 75260kb

input:

1000 2
b
b
a
b
a
a
a
b
b
a
b
b
b
b
b
a
b
b
b
b
b
a
b
b
a
a
b
b
b
a
b
a
b
b
a
a
a
a
a
a
b
b
a
b
a
a
a
b
b
b
a
b
a
b
b
a
a
a
a
a
b
a
a
b
b
b
a
b
b
b
a
a
b
b
a
b
a
b
b
b
b
b
b
b
a
b
a
a
a
a
a
b
a
b
b
a
b
a
a
a
b
b
a
a
b
a
b
b
b
a
b
a
a
b
a
b
b
b
b
a
a
b
b
a
a
b
a
a
b
b
b
b
b
a
b
a
b
b
a
a
b
b
b
a
b
a
b...

output:

46452553

result:

ok 1 number(s): "46452553"

Subtask #5:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Dependency #4:

100%
Accepted

Test #65:

score: 0
Wrong Answer
time: 33ms
memory: 98628kb

input:

2 5
caadeecaeebecaebccaabeceaacceccbddebaeaecbaedbabaaecdeccdbaeabccbaaddaeaeaaeacedaacecaebeeeeeccadeabdcdbededdbbcaacbedecedbcacebebeebcbebeceabceddeeaedaeebeaddcddbbbeaedadedddabceceebaeacebdcbeadaaabddbaecdddcaeaadecbccceaeeedbddbcaabacdbdaddadeddaccaeeaeededcabedeadbceabbdedbadeccdecedbdbbceeba...

output:

295384286

result:

wrong answer 1st numbers differ - expected: '295695131', found: '295384286'

Subtask #6:

score: 0
Runtime Error

Dependency #4:

100%
Accepted

Test #102:

score: 0
Runtime Error

input:

2 5
dabcabbaaaacebcdbacedeedeadecadeacdddddcaaddadcedeababacabacbcaabccdcdceaebadcddceebbebbecdebabbedddbbdedbaebccbbebbaeeebbdaeeedebbcbdccdecadeeaeedddccabddbddebecdeaebbaaabdddaeadacaddeeaddcbbbddecbcbdbaedcdacbbcaecdccbcedaecdecedeccaacdeddacbbaccebebadcdeeacbabacabdabdecdadbceadecceaccabaadadbd...

output:


result:


Subtask #7:

score: 0
Skipped

Dependency #3:

0%