QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#449049 | #4631. Interesting String Problem | zlxFTH | RE | 469ms | 249620kb | C++14 | 4.4kb | 2024-06-20 16:28:28 | 2024-06-20 16:28:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 5e5 + 5;
template<int N>
struct SA {
int rk[N], sa[N], h[N];
void init(string s) {
int n = s.size();
iota(sa, sa + n, 0);
sort(sa, sa + n, [&](int u, int v) {
return s[u] < s[v];
});
rk[sa[0]] = 0;
for (int i = 1; i < n; ++i)
rk[sa[i]] = rk[sa[i - 1]] + (s[sa[i]] != s[sa[i - 1]]);
for (int w = 1; rk[sa[n - 1]] != n - 1; w *= 2) {
static int tmp[N], cnt[N];
int o = 0;
for (int i = n - w; i < n; ++i)
tmp[o++] = i;
for (int i = 0; i < n; ++i)
if (sa[i] >= w) tmp[o++] = sa[i] - w;
fill_n(cnt, n, 0);
for (int i = 0; i < n; ++i)
cnt[rk[i]]++;
partial_sum(cnt, cnt + n, cnt);
for (int i = n - 1; i >= 0; --i)
sa[--cnt[rk[tmp[i]]]] = tmp[i];
copy(rk, rk + n, tmp);
rk[sa[0]] = 0;
for (int i = 1; i < n; ++i)
rk[sa[i]] = rk[sa[i - 1]] + (tmp[sa[i]] != tmp[sa[i - 1]]
|| sa[i - 1] + w == n || tmp[sa[i] + w] != tmp[sa[i - 1] + w]);
}
for (int i = 0, w = 0; i < n; ++i) {
w = max(0, w - 1);
if (rk[i] == 0) continue;
while (i + w < n && sa[rk[i] - 1] + w < n
&& s[i + w] == s[sa[rk[i] - 1] + w]) ++w;
h[rk[i] - 1] = w;
}
}
};
template<int N>
struct SegTree {
int sz;
struct Node {
int ls, rs, cnt;
} t[N];
inline int ls(int u) {return t[u].ls;}
inline int rs(int u) {return t[u].rs;}
int modify(int u, int l, int r, int p) {
t[++sz] = t[u];
u = sz;
t[u].cnt++;
if (l != r) {
int mid = (l + r) / 2;
if (p <= mid)
t[u].ls = modify(ls(u), l, mid, p);
else
t[u].rs = modify(rs(u), mid + 1, r, p);
}
return u;
}
int query(int u, int v, int l, int r, int k) {
if (l == r) {
return k == 1 ? l : -1;
}
int mid = (l + r) / 2;
int num = t[ls(u)].cnt - t[ls(v)].cnt;
if (k <= num)
return query(ls(u), ls(v), l, mid, k);
else
return query(rs(u), rs(v), mid + 1, r, k - num);
}
void clear() {
sz = 0;
}
};
string s;
SA<N> sa_;
auto sa = sa_.sa, h = sa_.h, rk = sa_.rk;
int n, m, o[N], rt[N], RT, SZ, dep[N];
LL q[N], ans[N];
SegTree<N * 30> sgt;
vector<int> G[N];
int mn[N], mx[N], cnt[N];
void dfs(int u) {
mn[u] = 1e9, mx[u] = -1e9;
if (u < n) {
mn[u] = mx[u] = rk[u];
cnt[u]++;
}
for (auto v : G[u]) {
dfs(v);
mn[u] = min(mn[u], mn[v]);
mx[u] = max(mx[u], mx[v]);
cnt[u] += cnt[v];
}
}
void sol(int u, LL &sum) {
static int cur = 0;
for (auto v : G[u]) {
LL len = dep[v] - dep[u];
LL val = LL(dep[u] + 1 + dep[v]) * len / 2;
LL res = val * cnt[v];
while (cur < m && q[o[cur]] <= sum + res) {
int l = dep[u] + 1, r = dep[v];
while (l < r) {
int mid = (l + r) / 2;
LL nval = LL(mid + dep[u] + 1) * (mid - dep[u]) / 2;
if (q[o[cur]] <= sum + LL(cnt[v]) * nval) r = mid;
else l = mid + 1;
}
LL A = q[o[cur]] - sum;
if (l != dep[u] + 1) {
A -= LL(dep[u] + 1 + l - 1) * (l - dep[u] - 1) / 2 * cnt[v];
}
int i = (A - 1) / l + 1;
int j = (A - 1) % l + 1;
int id = sgt.query(rt[mx[v] + 1], rt[mn[v]], 0, n - 1, i);
ans[o[cur]] = id + j - 1;
cur++;
}
sum += res;
sol(v, sum);
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> s;
sa_.init(s);
n = s.size();
cin >> m;
for (int i = 0; i < m; ++i)
cin >> q[i];
iota(o, o + m, 0);
sort(o, o + m, [&](int u, int v) {
return q[u] < q[v];
});
for (int i = 0; i < n; ++i) {
rt[i + 1] = sgt.modify(rt[i], 0, n - 1, sa[i]);
}
RT = n, SZ = n + 1;
static int tp, st[N];
st[++tp] = RT;
st[++tp] = sa[0];
dep[sa[0]] = n - sa[0];
for (int i = 1; i < n; ++i) {
int u = sa[i];
dep[u] = n - u;
while (tp > 1 && h[i - 1] <= dep[st[tp - 1]]) {
G[st[tp - 1]].emplace_back(st[tp]);
--tp;
}
if (tp > 1 && h[i - 1] != dep[st[tp]]) {
int v = SZ++;
dep[v] = h[i - 1];
G[v].emplace_back(st[tp]);
st[tp] = v;
}
st[++tp] = u;
}
for (int i = 1; i < tp; ++i) {
G[st[i]].emplace_back(st[i + 1]);
}
dfs(RT);
LL sum = 0;
sol(RT, sum);
for (int i = 0; i < m; ++i)
cout << ans[i] + 1 << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 15480kb
input:
pbpbppb 3 1 2 3
output:
2 4 7
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 15416kb
input:
potatop 3 6 30 60
output:
6 3 4
result:
ok 3 lines
Test #3:
score: 0
Accepted
time: 124ms
memory: 25528kb
input:
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
output:
323 644 809 442 923 155 645 275 443 779 441 563 830 495 442 71 699 649 467 204 755 274 394 316 604 211 503 455 764 515 691 541 76 369 695 734 953 440 322 808 693 690 565 116 420 861 179 358 640 687 735 796 581 473 593 859 876 666 596 587 515 616 58 425 470 707 556 735 194 789 819 788 582 666 525 270...
result:
ok 500000 lines
Test #4:
score: 0
Accepted
time: 145ms
memory: 25368kb
input:
gtgggtgttgggggtgtgggtgttggtttggggtggtgtgggttggtggggtgggttgttggttgggtttggggtgttgggggtgggttttggttgttggtggggttgttggtggtggggtgggttttgggttggtgggtgggtggttgtgttggttttttttgttgggtttgggtgttgttgtggtgggttttggttggggtgttggttggtgtggtgtgggttttggttttttgtttgtggtggtgttttgtttttggtggggtgtttgttgttttggggttggggtgggggttgtgg...
output:
791 715 455 614 589 333 462 296 719 129 801 506 651 668 60 784 111 326 964 356 442 261 328 390 482 320 382 555 729 612 819 154 591 442 890 652 359 652 832 676 670 359 575 146 304 402 71 626 510 209 601 705 29 722 579 502 904 229 712 76 940 897 403 810 506 832 422 183 365 648 659 344 621 478 268 605 ...
result:
ok 500000 lines
Test #5:
score: 0
Accepted
time: 131ms
memory: 25376kb
input:
uuppuppuspusupspsuspsusssuupspppuuuusupspsssssusppsppsppsppsupuuupsssussupspsupsusssppsuuppspsuuspuppssppssusuussuuuupsspupssupuuppppsspuuspsupsususussupuppuuusspsuupppspspuupuppuuspssususpsususpsspsspssuuupuppppsupusupppsppspsuuusspupuspuspsusspsuspuspssuupuupsssupupppspppupsuspusppssusspspsuuuspsp...
output:
962 574 660 750 321 290 141 797 243 259 884 743 737 117 263 491 886 547 707 637 228 362 319 942 424 511 174 963 30 802 355 175 186 732 438 147 295 303 611 716 528 587 598 494 515 447 950 469 696 878 638 429 699 497 566 641 624 229 325 663 747 36 695 480 307 108 558 379 485 425 590 499 129 432 308 51...
result:
ok 500000 lines
Test #6:
score: 0
Accepted
time: 125ms
memory: 25384kb
input:
vqvvsvvvvqssssvxvxsvxvsvxxqsqxqvvxvqqsvvsqvvssqqxvxvqqxqxvqqsxvsqxqvvxxvsxvxxssssvqvvsxvqvvxxxsqxvxxsqssxvvxvsxsvsvvvxsxvsvsqvvvqsssvvvqxssqqqxvqqvsqqqsxqqxvvsqxqqvsxqqqqvqxxqvqvqqqvsvsvxsvssvqvqxsqqvxvqqqvqsssqxsvqvsqqxqqqqxsxxxsvsqqqxvssssxssqxsxxvxqxvqsxxxqxssxxvsxxxqqvsqxsxxxxqxvsqsvsqsqssvsxqsv...
output:
632 645 793 548 149 257 583 737 498 191 455 342 416 572 682 546 730 158 683 772 369 410 637 367 398 201 385 878 615 531 578 603 773 560 723 46 763 497 645 798 480 476 352 871 301 514 614 907 301 378 52 147 686 646 721 132 185 716 614 799 720 266 143 161 319 409 750 403 190 775 746 718 378 839 537 58...
result:
ok 500000 lines
Test #7:
score: 0
Accepted
time: 136ms
memory: 25376kb
input:
hcccjchdjcccjchhhdjnjdhdhdhjhjnhdcjdjjdddchchdhnhnddjdccdchcjddhcdhhcnhcjjjdjcjndcchcjnnddhdjhdddjnncnjdchhhdjcjhdjjdcjdncdcccncdcncndcjcchdhhjnhjdjnnddcnjnhcdhdnhnhjdjjjdhcdhhdjdjcdchcndcndnddjdnndjhdnndnhcdcnnchdcjndnhnnhhnddcjjndjnnhnccjhjjdhdhcndcjhjhcdccncjndhcdjndcdndnjdjhddchccdnhjnnchhhhhhjn...
output:
247 451 133 282 286 164 366 496 475 128 537 614 823 528 451 754 529 770 290 494 775 601 511 273 615 321 494 272 187 291 658 543 490 480 602 770 625 568 342 281 715 589 79 336 664 55 612 445 202 778 414 400 69 483 520 604 590 187 537 88 463 817 639 335 218 645 335 532 259 555 288 221 326 333 791 348 ...
result:
ok 500000 lines
Test #8:
score: 0
Accepted
time: 126ms
memory: 25372kb
input:
cjggyjgjcffcgczjyjzjjzjgzcyzjczjffycjzccjycyjjyfyfzcjggggfcygcygjcjczcyzjffffyfzzzfzzgjyfccggzzgfygyzgcjgzfyczyyjggfyjyzjjjzyfzzzffcgygjzjjzfgzjfyjgjycfgygfgzcyfzjjjzfgfjjgjfyyzyfcfccfjgyzczczzfzgjgjzyfgzygfgjzjcyyjzyffyczzfjfgzyycygfcccyzzjcfcfccgffyjygcgfycyjjjfjjcjggjcfgcfgfjjcgzjzyffyccjfzycjggy...
output:
832 500 318 646 402 803 626 778 275 460 807 312 393 670 580 729 368 301 428 504 735 331 206 492 203 665 429 816 724 502 744 684 727 282 63 553 397 708 512 729 299 507 602 681 218 535 440 327 607 400 241 904 481 274 735 871 669 460 502 593 862 250 674 745 339 584 252 272 333 819 583 455 99 513 265 43...
result:
ok 500000 lines
Test #9:
score: 0
Accepted
time: 145ms
memory: 25380kb
input:
illulituiuyifyufffilyuilnynliiftnyinunltinnltluiltinuttuffiffitfylttiiltnuuiflfiuiuntiniluiinffyiylunnufitlltnntnufuiltnyuyunuflfilufilluinllttinntliufyytnifytfuunltlnffiiyluuifyftnyifnntfilliyyiunfiffyiytnytlnuilinfynunttnyttnuttiiittnntntytittiyyniiutfffynfuffiiilfyulffynnufuuuyiffuyyyfuitflntlnni...
output:
80 323 340 267 796 859 296 257 100 585 696 209 376 396 827 443 107 407 765 386 346 596 592 816 422 306 418 561 346 510 724 269 741 551 299 760 240 639 191 567 252 263 488 284 323 563 395 268 628 284 645 290 556 808 322 167 641 609 645 307 250 756 938 717 736 217 279 275 173 301 616 433 599 727 717 1...
result:
ok 500000 lines
Test #10:
score: 0
Accepted
time: 154ms
memory: 25276kb
input:
aykyaaucykauxckywnaxwwawxycxyanaayckkxuxccawukxkuaxnyxuxcxucynkkknkuuxwwxauyywxakkwwuwxkyuncuunxwkaxwnkawkxxxykwuauccyaanunkxawwxwckukykcuuxwnwxwcynnukwucukkwkayuyakuuxknaxknnkakkukukxucxkcnxcaxywaawuxaaxayknxwwyxkncnuwkuuxwywxxayxkukwxawnakyuxnkwkwaucxkknxxackuuyynkyccuucnuknynnyyucxnuxwwckwykawxyw...
output:
314 632 448 318 153 717 464 469 279 634 511 747 851 273 548 406 614 490 130 222 68 47 635 559 840 406 339 144 584 600 941 672 237 537 451 769 342 459 522 789 601 352 383 395 585 713 304 406 637 408 794 674 424 638 378 330 241 193 847 509 895 363 605 366 293 239 657 459 460 343 663 518 837 355 633 20...
result:
ok 500000 lines
Test #11:
score: 0
Accepted
time: 140ms
memory: 25392kb
input:
iyaaobwiwaawywiovmaabvwomwmmobwvowoywiawmimimfvyyywvimvofwwmvfwfowbyombmmmbboooobvmfvfoawiwymfoomiwivyvobfwivmfiayyofvmvammwmbfowifmmoaifwaiovywbfymifmibobiawoiiiabfwomwiayobwyvvommafabmmmmiiibiwvbbmommbofbyvmvfwiowaovyyoywmwbyfmmbmvyimwoiivmmomyvbmommoavmbbiimovfiafwiaffbbffiymvvoiwwywowaoofayyafif...
output:
183 956 637 305 204 263 879 544 658 538 382 635 673 486 411 239 188 89 281 768 566 708 249 227 388 827 388 357 978 203 524 227 608 600 643 835 436 63 558 387 89 698 239 233 526 491 270 839 498 523 696 944 766 925 842 56 705 367 464 174 537 127 535 368 687 466 139 870 279 86 593 703 586 899 422 779 6...
result:
ok 500000 lines
Test #12:
score: 0
Accepted
time: 136ms
memory: 25368kb
input:
vbvvddssmuqqsybsyygvqviduqbgiviqbbsqgisgvyguiqyssqiyuiumsbuiyqgqivqvbysvdmuigvsviubimbidbsygqdgsgdgqbdggidbbyuuddsdsvyivgddyyudmsuvgvdbmvdiuyyibuqdvvgqsuqmisubyqiudgyqmsmiysyussygbvyvsivimqqmviisvvbqsbqsgyiggbbimiqsmisiidqdusvivqvyibvvgmmbqsudigiiqdmdbubvbvusbyygydbqmdggvmqmdbdudidsymqbqbuiubmvqgduv...
output:
463 682 567 495 449 309 588 253 736 105 362 309 282 910 434 734 670 741 810 616 331 695 804 273 347 262 830 251 515 351 677 275 832 718 12 188 53 476 769 220 575 825 509 808 361 468 354 797 684 240 182 469 162 166 349 757 549 395 572 258 616 123 405 589 647 314 611 796 816 650 394 608 40 176 409 203...
result:
ok 500000 lines
Test #13:
score: 0
Accepted
time: 143ms
memory: 25336kb
input:
btcuswtwttuulltfdllcdcyccdqwyfbqlyqbqwuqqquccqqluqqsuswfbqtcbdtldfylsllfbddtbdcbwdbcdwwbqcdtcudqdcylwstttduddbubwysydqqsyswwqfcutyyclyqlqfbwscycwttdfsldfssfqftydcftldwfuubyfqfscfwbstcylblqftsqbdybydbtcbfqlcqtssbtulyfstuytdwcbbylqutqlcfwtuwwqldycusqwwyluqwwubfyllqcqfstcufwlwulcbbwdsudfltqtdcsclyylywt...
output:
250 786 289 222 220 212 705 946 856 337 580 497 792 174 172 699 89 378 888 447 155 795 599 619 543 523 492 368 319 470 478 429 715 136 201 647 792 203 565 560 160 792 682 601 866 728 239 792 416 272 557 583 221 853 290 695 13 762 314 356 553 623 345 477 647 585 530 326 334 105 474 447 388 510 579 29...
result:
ok 500000 lines
Test #14:
score: 0
Accepted
time: 145ms
memory: 25376kb
input:
sblrorbgldylcdrxooszdrxciizgrlgcxrobrldirgxdxgcoscszlzlydyllzxdzirsxscsozrglbdgbxbgdbsxorlxxcgxizdxgoxocicxdiislosrxocxgszxixczrbllisdbgcsyzxlliidzdxdsoyrbcizcblrdxillybszbycxyicdbcssdlsiixizrlgobzoizcdrdrzlrigblziyrzrooczdiogdodbsyslcdcgrzycoiosxblixizdsglxdrisszcgisilbxgobiygzdiysxxydcxxrlbcrgzdiy...
output:
897 785 754 226 868 764 631 345 798 779 522 748 401 155 702 266 469 287 680 808 195 819 77 883 91 328 423 493 520 363 196 414 330 920 349 496 428 473 435 521 727 872 796 680 578 363 518 456 521 416 532 380 742 732 429 605 315 147 777 569 519 606 816 146 308 587 540 313 775 843 233 106 667 317 217 49...
result:
ok 500000 lines
Test #15:
score: 0
Accepted
time: 158ms
memory: 25360kb
input:
zcfkrrjhbjkzrafjbfvcbhfckpkkgsrvjcjkhcrrsazcjcvbajhpaazapasacszskzzbsbpszhfrpjgjhgpaappvzhjrgrfzzbszkzaccksjhsjczbvhkpzzkarkjzvzvzcbvfshazvpfbzcpkfrjfbachksgzrsagkgzvvavzkppbvjcvjgzavgvfjjvhgczzvhfhcrcjsskzpvrzvbgzbgzrghgkjgaafghgjhcvbgvzrbhjrfjsakbrbscjfpkcsbhjzfkrjpkrpsgkahfkjrakzzjjvcaphkjvhfzkgh...
output:
314 530 217 222 163 509 286 290 589 843 533 543 366 827 440 571 925 223 646 294 683 251 533 112 590 448 741 504 493 652 339 45 307 421 343 493 643 198 810 715 546 617 531 568 575 411 424 225 392 675 149 642 603 192 297 698 529 395 471 775 783 301 481 478 742 318 346 479 754 405 642 357 437 634 842 3...
result:
ok 500000 lines
Test #16:
score: 0
Accepted
time: 155ms
memory: 25440kb
input:
nctmfuwtjtktmkwlfpmjuwnklufnftrjuwpcjrntuwpkwpphwckfqrmqtkcmltmhufcmjtmhtuqfhclnnluuwpjqwmtpwkppfnclcjpchkkmwnutrhwnpnmhcuctffkcpflqnjrnjnfkhwmnmcpwrrttpnwcfnqrjlqmtkncfcqjufkjctlwmhnfcnhpnmmktnjphpmnqwcjqmmfjukllwurnccmqhquhrfumqlmtmthchuphpullnmmthpwrhwlkpujlkphnftpnhtnlkmunfnpqjfjpppnmmqtfjwnfhcc...
output:
555 466 88 100 586 159 839 920 180 519 487 492 251 766 377 264 611 400 423 658 479 239 671 698 352 157 537 124 141 385 853 523 705 595 677 580 694 490 529 648 863 818 523 668 775 923 648 489 399 161 146 239 276 376 694 915 337 745 833 554 469 751 172 949 582 606 501 332 120 605 245 827 26 806 808 84...
result:
ok 500000 lines
Test #17:
score: 0
Accepted
time: 138ms
memory: 25376kb
input:
qpwnfmpwfufwiieehpfuwuepigxfuevgepiuihmwformmurfrxueurfvnxrimhihxfofonqhpreffrnhnefhqxwopiupouqqogomoohienioworxfwugrigehxixiifefrgrfgqvorngnvqwwfxeouiegxfohivmhqvqiihmoxwgnughgewmxpuqfrpvrvpmureumnxqehnwnqrgghwwieopxmnpmvimfqvmmhviepxinropffvngwhourxguvhuripfpniugevigrgmonvqieeqxpiqwvfmxvmevhmhhiuw...
output:
825 442 454 437 589 662 540 633 664 417 129 710 313 295 756 727 745 747 822 807 990 835 590 304 122 153 241 476 27 826 243 645 936 79 550 328 450 479 621 953 583 397 947 510 844 233 458 210 506 864 612 336 940 428 560 881 156 405 156 225 418 824 452 599 415 653 444 495 358 544 275 424 323 564 767 78...
result:
ok 500000 lines
Test #18:
score: 0
Accepted
time: 139ms
memory: 25424kb
input:
tgaxtbbpxabtqufqkucxqzhqraobozqpiftzbafxhcbuqhuiifhtrrpihobxxcuttfqhpkrzkbpotaghbqtupoqpoczahtpczbxikrioxbpxctpxbgocqbahqobitipfhoqragtqrcgcihgotichpuzcqkoobhhgtutihrpgxkbqxohgcthffhcfopfapbphqfapgzqgahupfagzzhpopkbgtfcqafpubqhzizzqtgqpkopioxbzahihrqiaappxzgzxxrccxpiafpbxiffoquhuibbchxukziqcfcfopzxg...
output:
214 800 730 369 127 702 475 496 765 402 300 763 805 230 161 309 704 468 845 348 611 476 157 781 227 292 759 187 96 793 734 742 414 583 500 144 781 787 397 377 562 554 395 495 234 335 273 436 622 707 322 764 561 704 504 481 453 472 229 240 475 701 535 117 495 521 198 349 266 449 727 877 655 522 736 1...
result:
ok 500000 lines
Test #19:
score: 0
Accepted
time: 148ms
memory: 25276kb
input:
wwtjqqtttozlzdsjwfkojmsvlofvkhvrvdzlmwzkshqlfzmgkzqklkjhztvjwgtmxvrglwmvkottxsftmwmsvgqmgqhrsszwdkldjkvtlvtzlvgfzwvszqsohkdgflgvlfgkmxmfvosxhsjsomxmsgtozwrogkrffgqwmtlljwsqxshgtkmdkwrktdzfwxljjvosxjqogxmrvomqzoqkrkvtlmgqfgjzfsrfwdrwzskdtjlsodzhwxxfdwjljzoofdqtdhjwolktjgdjwxzhtxrdstrrrwsgdmwgorldllho...
output:
75 169 331 747 547 740 691 629 199 527 592 470 186 715 383 480 408 153 539 438 482 364 388 513 748 600 50 67 562 204 930 141 630 282 803 588 806 588 302 327 613 711 687 248 662 509 538 741 635 299 607 561 461 227 181 915 236 439 340 160 131 572 492 427 374 495 859 199 674 850 790 868 507 876 463 376...
result:
ok 500000 lines
Test #20:
score: 0
Accepted
time: 137ms
memory: 25384kb
input:
iadnxnxelwnjiiwxcteaxpcmphvwphjidjpnwimahcjtmvizihxhsnammddtzevjvoimnhlxjnmjwihaxcpepneacwpmjeevtpvsdzsmaztzclaeoxdntaoazxllsemascencxopanjaxdcntipxedxzjdeipidwmzovesvtoijshcwcixjievvdoadilojazolcnldahxiswppmdjzwlmnanmcpvewjhihdmstixstsijlwotlpmlpsxlevzainmznatvzllihtjpnpxlnhedmpwlwhvxitatjcniapoije...
output:
352 605 309 148 612 282 515 561 681 628 493 883 485 795 649 778 342 630 756 646 781 537 444 442 445 824 736 570 244 433 393 363 424 185 919 162 453 808 712 540 277 281 713 360 199 434 804 51 584 557 928 291 846 554 774 494 255 443 608 627 144 818 836 630 435 504 525 292 544 211 696 232 438 131 136 9...
result:
ok 500000 lines
Test #21:
score: 0
Accepted
time: 135ms
memory: 25340kb
input:
yqoopvwnfaubnvwpybhpbjoonfiqbvjbuyhyvvbjusiniphqcbuynkvheonvvhkkfbycuknmmvawjefuwyjppccakqjcfaoeiwvfhyipwhhkswhswjoaubvhuqoncfwemnqnucpusscahavbijffcbffqnfafamvmmoschhyenfnhwfouipmwebfinyyqjhimwopjbhypsuqwynyjbocjysubhbyshjnoeefcwyhpaiihnbupoeebickkqewkwnjiwkhbyioupqmkychimpopsonuvwmwkffvqpcnbmhqhmp...
output:
685 699 668 733 424 825 474 262 517 437 342 661 656 176 898 370 591 746 676 497 530 477 361 637 588 320 426 394 247 130 379 195 314 632 491 449 365 420 270 456 468 398 487 630 694 514 914 832 32 402 530 370 242 802 416 431 421 175 542 243 489 479 810 346 80 770 381 594 523 874 522 572 750 305 33 646...
result:
ok 500000 lines
Test #22:
score: 0
Accepted
time: 137ms
memory: 25424kb
input:
nlofuytixdmtwouugdfosniyfodlpmlmftlewdsptcecnlynddneysyceudxcismpluopzexnpzttxppfzonmgpmnuemiyfzfxzegbvsxziwezwmnleyogxpcdvivynstweupygspivlcpomnbfusgiudiollwlvtxsdswcnupxzositewmnwnzcwmptisdvtbsiwtupoppximyfvuiytfyvfcpsocelpevcvntultngnmgiluucsixbxbzgyecuetzecbndlgbvteptfbscnonextldlgbeybimcczmugdn...
output:
339 774 271 325 91 772 620 853 375 938 288 878 245 771 652 338 393 558 46 523 672 169 834 244 535 889 665 298 41 553 431 625 380 485 58 326 438 668 267 599 592 133 374 429 895 484 379 616 71 781 549 547 481 168 609 795 690 786 720 497 641 755 249 681 919 466 291 378 610 492 574 580 616 349 786 336 8...
result:
ok 500000 lines
Test #23:
score: 0
Accepted
time: 125ms
memory: 25436kb
input:
evgsxyszizjvkayssyjimmvexcignjtcgpqztggfgjiqccnjugafqiyafspiegpmanhgevghxxasigntxgvfuvgmzzxfgfvogzggfqekkszfauhpjezffvtktkxyxcktzfsvueokzsmpfiiyauxeuuecokqteyaajmnyzygnnmzgshnyopfiysxuzoezfzvaonhvogsxkqmcspmoeeiyqkkfmcyieegyhgsnqxqvahyegohspkyecujsisixkuvymivkzjaqopeksnshsegyhemaqityucjhegjycghukpii...
output:
684 884 353 433 715 517 304 179 855 729 615 400 272 609 727 589 173 417 613 714 559 616 859 705 306 772 422 314 681 206 355 516 369 826 476 434 60 548 193 530 238 532 524 164 809 426 126 346 818 386 43 86 574 411 230 466 548 280 450 682 99 767 464 625 305 147 32 391 709 866 947 119 748 701 421 818 6...
result:
ok 500000 lines
Test #24:
score: 0
Accepted
time: 138ms
memory: 25384kb
input:
ovoojjlcfwuqpcneuhknkcvqkiuotuwfsczcpokkryumycqebwzpwjehopuyfiwihovecyqewqzuuerieszwutuwfjtkznsenirjthcptrjribfkeihyusrufntjjtsecrpqrubclfooykroczvhqywpnfwkjyjmwmpnyciskmumzsrsjspqqusefmoofvoszfizrrcnjqnbvzreemesrvorkmhitwzejmrhcikscosymjvcmjecmuzmsthkqwycwpbouineiflnqucyohriqmkykhflqrmpijqlwjfmyttf...
output:
531 706 107 412 248 638 317 865 266 419 869 257 331 601 266 318 400 638 481 582 371 328 416 589 239 466 517 481 661 386 610 665 281 380 413 122 308 712 486 608 491 558 506 618 770 500 497 499 807 588 436 619 879 481 648 114 634 622 738 670 577 838 467 423 587 146 674 371 606 92 197 418 393 317 569 3...
result:
ok 500000 lines
Test #25:
score: 0
Accepted
time: 135ms
memory: 25360kb
input:
nvhhpnuysrbeuylwdgivwbsiegwrhbhbxybyludoaqewloavndbxenhaionhlyonwqxtvddyaftayskertyufnhwxklhousuvnatorulwxrkkbdrtfxtdrtunygukdlccfldgducurcfsfvxdbqahkpnivukfwqncpprbkxlouwcbqypcqeqtsbxghhiairctwordktkoancfgsckdvqsrcnkpsbecoctuulyrapqiwrsnrcoqdxrpyrhdcxsvfxfekslxlprssvtrwsalgyhthvdnhvesfeucdccirfirkq...
output:
674 115 623 625 75 750 871 647 575 641 559 519 704 398 764 805 667 437 375 932 205 712 207 876 590 264 936 75 460 121 647 420 309 215 255 287 262 320 511 941 107 498 713 373 822 508 536 658 562 183 314 341 542 758 740 852 735 90 667 569 150 513 827 750 367 445 858 528 439 886 987 873 669 743 952 411...
result:
ok 500000 lines
Test #26:
score: 0
Accepted
time: 131ms
memory: 25392kb
input:
qnclwkavcnrqyegjasqqsrjsnsybneliwmocgacduivkussloxklajrloagadudikenalwmozevggcarbikgvaamjelqateowqsjhxqsgamabjtignibxidhxyxxxdzdiottlgeoujgihlndxlvoeoincmtooouveahrttnznuswogsudngbdynsrlgkwmbdducdquorudwqkatwybezekxwxvdwkngxoaakcowkwcebvmdgudguogwbstzewdgikohtdsujwngxcehgtorzcxlyxhtabrmojqtdcwxribvd...
output:
719 201 476 708 469 696 747 397 887 248 175 359 504 218 684 655 671 504 799 758 737 391 545 556 204 910 414 435 160 700 726 198 386 733 622 402 257 580 375 251 251 260 286 226 333 457 114 302 206 825 457 391 149 646 724 640 407 149 691 575 291 282 592 195 462 507 614 885 162 825 444 874 637 612 561 ...
result:
ok 500000 lines
Test #27:
score: 0
Accepted
time: 138ms
memory: 25272kb
input:
wyegkiddibdhattrwgvqqtznwnqteeafiyenwsislkaqhhkuhrkkadcmfkrookocynirclwasnpcypxrxsaonsfyedmtkmyeugcuaureyrotbfchclwfdnwobktrkixmdowoucsfkwluwxslozpxbafqietyatqgedpvxibqseobffwzwxnroifyfrqnnmgmrulsscyztwybupzuavfuyuvqxwkgtnqxrfoizzrwtaxiynkszmzuzrzitermqcarybxpwftiogdakopapwbmahtzdesnwloydxyydyuomnyt...
output:
802 656 792 425 37 437 647 557 740 593 339 394 100 236 492 201 394 567 197 509 266 558 140 732 381 710 718 488 220 485 400 531 687 567 491 482 499 467 666 627 707 236 632 619 334 713 233 752 184 644 461 466 407 921 355 192 661 187 832 619 259 398 843 363 412 269 551 272 420 639 693 690 527 827 624 1...
result:
ok 500000 lines
Test #28:
score: 0
Accepted
time: 141ms
memory: 25336kb
input:
mwmbcwtvwdrdwvmyeyxufotofxicsyxfuqvvgsmdmgaxgnefqcqmzdmxbkyaknbiiyxrvzedyadwzhrhdjnfxgscujrucnbejcygcccyqmeywhducissvvvvemkunevwdoebknnxtowyqwhpzlqpobqavbhtstrmriruxgkjrgoxbtosifmswgaseayewttdnqpcusxzjlevymiphhkbbmfrdjfucckzgphdaefgkumbmwyoytgiefibzqkbrcyneetwzxiikxwscugrlcezesjmtspioelcetkebqugxozz...
output:
927 203 480 27 138 402 495 638 450 473 848 598 585 482 267 600 928 574 822 331 202 782 520 543 223 717 402 590 714 665 384 879 477 603 488 223 328 40 316 469 723 649 391 403 487 615 475 219 609 602 622 490 808 381 696 263 329 919 944 498 578 695 602 545 240 453 281 454 437 686 548 729 830 431 863 18...
result:
ok 500000 lines
Test #29:
score: 0
Accepted
time: 469ms
memory: 249620kb
input:
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...
output:
204534 339376 229188 372153 306595 299296 135190 120175 59425 262135 373840 443124 248058 473765 384090 267790 389699 215949 119753 297288 187439 348956 353347 235360 228801 335856 84112 461468 381302 105245 359765 170287 460565 308835 144604 225539 149961 105019 216586 112974 175784 227004 260885 2...
result:
ok 500000 lines
Test #30:
score: -100
Runtime Error
input:
osoossooosoooossssssssosossoossoooosoosoosossoosoosssosossososssossossssssoooosossoossoosssosssssossoossososoososooooososoosooosssoooosssoosossoooosooooososssssossosssssossoosoooossoooosooooossssossosoooosssssossooosssosossossoososoosssoosssoossoosooosoossooosooossosssoooossossoooossoosoososssoosooo...