QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#720363 | #6197. 太阳神的宴会 | NineSuns | 15 | 2ms | 11948kb | C++14 | 2.8kb | 2024-11-07 12:09:19 | 2024-11-07 12:09:19 |
Judging History
answer
#include <bits/stdc++.h>
#include<vector>
#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 = 2e5+5, M = 2e7+5, mod = 998244353;
int n, k, id[M], f[M], cnt[N];
ll lv[45];
struct node {
int sz, len, fa, ch[6];
}v[M];
vector <int> pr;
int las, tot, o[45];
inline int tr (int p, int k) { return k > v[p].sz ? 0 : k; }
void upd (int k) {
// cout << "INS:" << k << endl;
int p = las, cur = ++tot;
v[cur].sz = v[p].sz+(tr(p, k) == 0); v[cur].len = v[p].len+1;
// cout << "NEW:" << cur << " " << v[cur].sz << " " << "CHECK_FA:" << las << " " << v[las].fa << endl;
// cout << "CHECK:" << v[2].sz << endl ;
las = cur;
while (p && !v[p].ch[tr(p, k)]) {
// cout << p << " " << v[p].sz << " " << v[cur].sz << endl;
if (v[p].sz+(tr(p, k) == 0) < v[cur].sz) {
int nc = ++tot;
v[nc].sz = v[p].sz+(tr(p, k) == 0); v[nc].len = v[p].len+1;
v[cur].fa = nc; cur = nc;
}
v[p].ch[tr(p, k)] = cur;
p = v[p].fa;
}
if (!p) return v[cur].fa = 1, void();
int q = v[p].ch[tr(p, k)];
if (v[q].len == v[p].len+1) return v[cur].fa = q, void();
int cl = ++tot; v[cl] = v[q]; v[cl].sz = v[p].sz+(tr(p, k) == 0); v[cl].len = v[p].len+1; v[q].fa = v[cur].fa = cl;
while (p && v[p].ch[tr(p, k)] == q) v[p].ch[tr(p, k)] = cl, p = v[p].fa;
}
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;
ll s = k, ans = 0;
for (int i = 1;i <= n;i++) {
while (tot) {
memset(v[tot].ch, 0, sizeof v[tot].ch);
v[tot].sz = v[tot].len = v[tot].fa = 0;
tot--;
}
las = tot = 1;
pr.clear(); memset(o, 0, sizeof o);
cin >> str;
for (char j : str) {
int x = j-'a';
if (o[x]) {
int id = 0;
for (int p = pr.size()-1;~p;p--) if (pr[p] == x) {
id = p; break;
}
upd(pr.size()-id);
pr.erase(pr.begin()+id); pr.push_back(x);
}
else {
upd(0); pr.push_back(x); o[x] = 1;
}
}
memset(f, 0, tot+1<<3);
for (int j = 0;j <= k;j++) if (v[1].ch[j]) f[v[1].ch[j]] = s; s = 0;
memset(cnt, 0, str.size()+1<<2);
for (int j = 2;j <= tot;j++) ++cnt[v[j].len];
for (int j = 1;j <= str.size();j++) cnt[j] += cnt[j-1];
for (int j = 2;j <= tot;j++) id[cnt[v[j].len]--] = j;
for (int J = 1;J < tot;J++) {
int j = id[J]; (ans += lv[v[j].sz-1]*f[j]) %= mod;
int ss = 0;
for (int p = 0;p <= k;p++) if (v[j].ch[p]) (f[v[j].ch[p]] += f[j]) %= mod, ++ss;
if (v[j].ch[0]) (s += f[j]*lv[v[j].sz-1]%mod*(v[j].sz+1-ss)) %= mod;
else (s += f[j]*lv[v[j].sz-1]%mod*(k-ss)) %= mod;
}
}
cout << (ans+mod+1)%mod;
}
signed main () {
int T = 1;
while (T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 0ms
memory: 7924kb
input:
1 2 bbbaabbbbbaabaabbababbabbaaabbaaabaaabbabbabbbaaabaababbbaabbbabaaaaabbbbbabbabbbbbabbaababaabbbababbbbabababbaabbbbabbbababbbaabaabbabbbbababaabbbbbabaaaaaabbbbbbbaaaaabbabbbbaaabaaabaababbbababaaaabbababaaabbababaabbbbaabababbbabbabaababbbabaababaaabaaabaaababaaaaabbaaaaabbabaababbababbbbbaaba...
output:
981227
result:
ok 1 number(s): "981227"
Test #2:
score: 2
Accepted
time: 1ms
memory: 9968kb
input:
1 2 abaabbababaaabbbabaaabbaabbbbaaabbbbbbaabbababbabbbbbbaaabbabbaabbbbbaababbaabbabababaaaaabaaabbbbaaaaabaababbbbaaabbabbaabaabaaabbbabaaaababbabbbaabbbaaabbbabbbbaaabbbbbababbababaaaaababbabbbbbbababbaabaaaabaaabaabbabbaabbbabababbbaabababaaaaabbbaaabaabaabbbaababaaabbbbabbbbbabaababbabbbaababab...
output:
981457
result:
ok 1 number(s): "981457"
Test #3:
score: 2
Accepted
time: 1ms
memory: 9848kb
input:
1 2 aaaaaababbbaabaaaabbaababbabaaabbbbbaabbababaaaabaabaabaaaabaababbaababbabbabbbaaaaaaabaabbaaaabaabaaaabaabbbabbaaababbbaaaabbbbababbbaaabbabbbababbbbbbbababbaaaabbbbbabbabbaabaaabaaaabbababbbaabbbbaababbbabbaababaabaaabaaaaaaaabaaabaaababaababbbababababbbbaababababbabbbbabaaaaababbbbabaaabbbabb...
output:
981717
result:
ok 1 number(s): "981717"
Test #4:
score: 2
Accepted
time: 1ms
memory: 7864kb
input:
1 2 abbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
549593
result:
ok 1 number(s): "549593"
Test #5:
score: 2
Accepted
time: 0ms
memory: 9820kb
input:
1 2 babbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
5989
result:
ok 1 number(s): "5989"
Test #6:
score: 2
Accepted
time: 1ms
memory: 7836kb
input:
1 2 baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
3997
result:
ok 1 number(s): "3997"
Test #7:
score: 2
Accepted
time: 0ms
memory: 7908kb
input:
1 2 abbaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaabaaaba...
output:
11949
result:
ok 1 number(s): "11949"
Test #8:
score: 2
Accepted
time: 1ms
memory: 7864kb
input:
1 2 baabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbabbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaabbbbbbabaa...
output:
298323
result:
ok 1 number(s): "298323"
Test #9:
score: 2
Accepted
time: 1ms
memory: 9908kb
input:
1 2 bababbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbba...
output:
11947
result:
ok 1 number(s): "11947"
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #10:
score: 7
Accepted
time: 1ms
memory: 9984kb
input:
1 5 badaeeaadaacedaaaabeabcabbcdbeadcabbaeaaabbdeecbdecaeaecceabebcddbdaaabddeadaeebebbcdcaedcacbaccdabeeeccbaebbadbdeabcbcdbccecacbecccadebbbdcacdcabdadaccadbaccbecdcccbbdbaaebeeabbdcbbeaadebecaccdcaeceabeaadbdecbecdbcccceabdaabcbaaeccbdebceeeeddceababaecabadeabaadeaabcbaaaabbcbcabcebdaebcbedcccaea...
output:
59251641
result:
ok 1 number(s): "59251641"
Test #11:
score: 7
Accepted
time: 1ms
memory: 9928kb
input:
1 5 bdbdcdaeaedaecdeccbdcdecaaeeeaeadcbcdbadcdcdeddbdccbdbddadcecbbdabeabbbecdddbacabebdecbacbbcaebdddbbadbccecacaecbebeecadeceaeecbbdecbdeacdecabbecaaedddddcbbecebcaebaeeeedecdcbaaacedaedacaaaaaceeaacedecbdbeacecbbaccdecbecccaeedecdbbecbdcbaababedeecaeeaaacebadbadbddaedcccbdbdeabcbbdbeddbbacdbaaade...
output:
59257546
result:
ok 1 number(s): "59257546"
Test #12:
score: 7
Accepted
time: 1ms
memory: 7812kb
input:
1 5 bbdbedabdeccedeabccabebccbaaeccceadabebabbebcbbbebbdcbadadcdaacdacbdedaeaaedaddcdeeadebcdedcbcabeaccdcbeececdbaadddcdbadcceeecdaebeaebabdbbadaaddededbcdccacbebcebadcdbcbddbacecaadbcaecebebbcdcceabbeebedcbbccdebcdbaaecebdcdeeecaccacbeebaabbcdcabecaddaddcbaaeeaadacababbdedcbecabaabadabedeeeacceddd...
output:
59256626
result:
ok 1 number(s): "59256626"
Test #13:
score: 7
Accepted
time: 0ms
memory: 8016kb
input:
1 5 edacbddddddddddddddddddddddddddddddddddddddddddcdddddddddddddddddddddddddddddddddddddddddddddbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
output:
11796771
result:
ok 1 number(s): "11796771"
Test #14:
score: 7
Accepted
time: 2ms
memory: 11948kb
input:
1 5 abdecaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
43297081
result:
ok 1 number(s): "43297081"
Test #15:
score: 7
Accepted
time: 1ms
memory: 10012kb
input:
1 5 aebdcaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
15014801
result:
ok 1 number(s): "15014801"
Test #16:
score: 7
Accepted
time: 0ms
memory: 7864kb
input:
1 5 ecabddecdacdbdeccacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacebdecdacebdecdacdbdecdacdbaecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdeceacdbdecdacdbdecdacdbdecdacdbdecdccdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbdecdacdbaecdacdbdecdacdbdecdacdbddc...
output:
49679211
result:
ok 1 number(s): "49679211"
Test #17:
score: 7
Accepted
time: 1ms
memory: 9960kb
input:
1 5 ebacdeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeeaeea...
output:
27506986
result:
ok 1 number(s): "27506986"
Test #18:
score: 7
Accepted
time: 1ms
memory: 9936kb
input:
1 5 dbceadaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdaceabecdac...
output:
43950531
result:
ok 1 number(s): "43950531"
Test #19:
score: 0
Wrong Answer
time: 1ms
memory: 9868kb
input:
1 26 ffdczbkzlrnevxxhowxmtgagaveotvbgrhayxfsrqlmocrzkchduecjvobzrxywdsgazytypvkrrqxdacxomcbvuhmnesdokjnniozcfscbenlimgfwwypyhrezpojeggkecyyeopaxprmistdqmntvirniwdgeliokjhctmheqnaslhklzbkiacnocjkwrtmcaklusxwyuwohjptwanouyofqncrmtdzqqvexnncdfxrorxiuvhpgcxwfrkyljehpnjbxwqngwximxhfrcvrzzapkmftgtuhvrdatc...
output:
1
result:
wrong answer 1st numbers differ - expected: '882426059', found: '1'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 13
Accepted
Dependency #1:
100%
Accepted
Test #46:
score: 13
Accepted
time: 1ms
memory: 7852kb
input:
2 2 aaababbabaaaabbaababbbaaabbbbbbbaababbbbbbbabbabbabbbbbbababbabbaababbbbbbbabaaaabbbababbbbabaabbaabbaaaaaaabaaababbaabbbabababababaaabbababaaabbaababaabbbaababaaaaaaabbaaababbaaabaabbaaaabaabbabaaabbbbbabaaabababababbaabaabbbabbaabaaabbababbbabaabbbabbbbaababbaabbabbbabababaaabaabbaaabbabababab...
output:
1959299
result:
ok 1 number(s): "1959299"
Test #47:
score: 13
Accepted
time: 1ms
memory: 7888kb
input:
2 2 bbaaababbbbbbbaabaaabbabbabbbbaabbabaaabababaaabbbbbababbbaaaababbabaaabaabbaaaabababaaabaaaaaaabaaabbbaabaaabbabbbabbbbaaaaaabaaabbbabbabbaabbbabaabaaaaabbbabbbabaabbbbbbababbabbabbbbbaaaaaabaabaaaaaabbabaabbaaabbbbabababbabbababbabaabbbabbbabbbbabbbababaabbabbabaaabaabbaaaaaabaabbbbabbbbababab...
output:
2932325
result:
ok 1 number(s): "2932325"
Test #48:
score: 13
Accepted
time: 1ms
memory: 7836kb
input:
2 2 bbbabaaaaabaabaabbaaaabababaabbababbbbbbaaaababbbbbbbbaaaaabbaaababbbaababaaababbabaaabaabbbabbababbabbabababbbbbbabbbbababbbaabbabaaaaababbaaabababbabaabbaaaabaaabaabbaabbabbabaaabbaaaaabbabaaaabaabbbababbabbbaabababbabbbbbbabbbababbbabbaaaaaabababababbaabbbbbaabbaaaabbaaababaaaabaabababaabbaaa...
output:
2932847
result:
ok 1 number(s): "2932847"
Test #49:
score: 13
Accepted
time: 1ms
memory: 7832kb
input:
2 2 baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
998023
result:
ok 1 number(s): "998023"
Test #50:
score: 13
Accepted
time: 1ms
memory: 9896kb
input:
2 2 abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
1026221
result:
ok 1 number(s): "1026221"
Test #51:
score: 13
Accepted
time: 1ms
memory: 7912kb
input:
2 2 baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1372091
result:
ok 1 number(s): "1372091"
Test #52:
score: 13
Accepted
time: 1ms
memory: 9976kb
input:
2 2 baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
7987
result:
ok 1 number(s): "7987"
Test #53:
score: 13
Accepted
time: 1ms
memory: 7840kb
input:
2 2 baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
364637
result:
ok 1 number(s): "364637"
Test #54:
score: 13
Accepted
time: 1ms
memory: 7888kb
input:
2 2 abaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbbabbaabbbb...
output:
59441
result:
ok 1 number(s): "59441"
Test #55:
score: 13
Accepted
time: 1ms
memory: 9880kb
input:
31 2 ababbabbbabbbbbaababbaaaabbbbabaaaabbabaabaaaabbbabbbabbbbabbbababaaaaabbbaababbabbabaaaabbaaaaabbabbaaabbaaaabbbaabbbbbbaaaababbabaaabaaabaabbbabaabbaaaaabbbaaaabbbbbbaaabbbaabbabaababaaabbabaaaaabbbbbaaabababaaaabbbbaabaabbbbbaabbabbbaababaabbbabbababaaaabbbababbbabbbbaaababaaaabaaaaaaaababaa...
output:
720427737
result:
ok 1 number(s): "720427737"
Test #56:
score: 13
Accepted
time: 1ms
memory: 7920kb
input:
31 2 aababaaaaabaaaabaaabbabbabaabbaaaaabbababbbbababaabbaaabaaaaabbbbabaabbbababaaababaaabaaaabbbaaababaabbbbabaabbabaababbaabaaaaababaabbbbaaababaaaabbbbababbbaaaaabbbbbaabbabbabbbaaabbbabaabaaabaaaabbbbbabbaababbbababbaaaabbaaaaaaababbabbbbbbabbaabbbbababababbbabbbbaaabbbaaaabbabbaaaaabaabaaaaaaa...
output:
571807039
result:
ok 1 number(s): "571807039"
Test #57:
score: 13
Accepted
time: 1ms
memory: 7836kb
input:
31 2 ababbaabbaabbbbaaaabbbbbaaaaabaabaaaaaaaabbbbaabbbbbbbbabaabbabaabbbabbbaaabbbbabaaaaaabbbbbbabbbbbbaababbabbabaaaaaabbaaababbaabbabbbabbbabaaaabaabbabbbbaaabbabbabbaabbabaabbabaaaabaabbabababaabbaaababababbaabaabaaabaaababbaaababaabaabbabbbbbbbbbbbaababaaaabbabbbbababbbbabbaababbbbaabbbaabbaba...
output:
325715314
result:
ok 1 number(s): "325715314"
Test #58:
score: 13
Accepted
time: 1ms
memory: 9896kb
input:
31 2 abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
788272657
result:
ok 1 number(s): "788272657"
Test #59:
score: 13
Accepted
time: 1ms
memory: 7844kb
input:
31 2 abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
830805666
result:
ok 1 number(s): "830805666"
Test #60:
score: 13
Accepted
time: 1ms
memory: 7820kb
input:
31 2 abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
744200473
result:
ok 1 number(s): "744200473"
Test #61:
score: 13
Accepted
time: 1ms
memory: 9876kb
input:
31 2 baabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaa...
output:
351845541
result:
ok 1 number(s): "351845541"
Test #62:
score: 13
Accepted
time: 1ms
memory: 7856kb
input:
31 2 ababaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbabaaaaaabbaba...
output:
400428613
result:
ok 1 number(s): "400428613"
Test #63:
score: 13
Accepted
time: 1ms
memory: 9864kb
input:
31 2 abaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaabaaaaaaaaaaabaaaaa...
output:
328678714
result:
ok 1 number(s): "328678714"
Test #64:
score: 13
Accepted
time: 0ms
memory: 7840kb
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
Skipped
Dependency #2:
0%
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%