QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#17071 | #1789. 密码箱 | Qingyu | 100 ✓ | 274ms | 10820kb | C++20 | 3.2kb | 2022-01-01 18:11:26 | 2022-05-04 13:09:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
const int N = 2e5 + 5;
int n, q, ch[N][2], fa[N], nodes, siz[N], l, r, x;
bool w[N], tagf[N], tagr[N]; char s[N], op[10];
struct Matrix {
int a, b, c, d;
Matrix operator * (const Matrix &B) const {
Matrix res;
res. a = (1ll * a * B. a + 1ll * b * B. c) % MOD;
res. b = (1ll * a * B. b + 1ll * b * B. d) % MOD;
res. c = (1ll * c * B. a + 1ll * d * B. c) % MOD;
res. d = (1ll * c * B. b + 1ll * d * B. d) % MOD;
return res;
}
} W = {1, 0, 1, 1}, E = {2, 1, MOD - 1, 0}, mat[N];
inline int PLUS(int x, int y) {
x += y;
return x >= MOD ? x - MOD : x;
}
inline void pushup(int x) {
siz[x] = siz[ch[x][0]] + 1 + siz[ch[x][1]];
mat[x] = mat[ch[x][0]] * (w[x] ? E : W) * mat[ch[x][1]];
}
inline void rotate(int x) {
int y = fa[x], z = fa[y]; bool k = ch[y][1] == x;
ch[z][ch[z][1] == y] = x, fa[x] = z;
ch[y][k] = ch[x][!k], fa[ch[x][!k]] = y;
ch[x][!k] = y, fa[y] = x;
fa[0] = 0, pushup(y);
}
inline void splay(int x, int t = 0) {
while (fa[x] ^ t) {
int y = fa[x];
if (fa[y] ^ t)
rotate((ch[y][1] == x) ^ (ch[fa[y]][1] == y) ? x : y);
rotate(x);
} pushup(x);
}
int build(int l, int r) {
if (l > r) return 0;
int mid = l + r >> 1, p = ++ nodes;
w[p] = s[mid] == 'E';
if (l == r) {
siz[p] = 1, mat[p] = w[p] ? E : W;
return nodes;
}
fa[ch[p][0] = build(l, mid-1)] = p;
fa[ch[p][1] = build(mid+1, r)] = p;
pushup(p); return p;
}
inline void flip(int x) { if (! x) return ;
w[x] ^= 1, tagf[x] ^= 1;
mat[x]. a = PLUS(mat[x]. a, mat[x]. c);
mat[x]. b = PLUS(mat[x]. a, MOD - PLUS(mat[x]. b, mat[x]. d));
mat[x]. d = PLUS(mat[x]. d, mat[x]. c = mat[x]. c ? MOD - mat[x]. c : 0);
}
inline void reverse(int x) { if (! x) return ;
tagr[x] ^= 1, swap(ch[x][0], ch[x][1]);
int d = mat[x]. d; mat[x]. d = PLUS(mat[x]. a, MOD - PLUS(mat[x]. b, mat[x]. b));
mat[x]. a = PLUS(PLUS(mat[x]. b, mat[x]. b), d);
mat[x]. c = PLUS(mat[x]. c, PLUS(PLUS(mat[x]. d, mat[x]. d), MOD - PLUS(d, d)));
}
inline void pushdown(int x) {
if (tagf[x]) tagf[x] = 0, flip(ch[x][0]), flip(ch[x][1]);
if (tagr[x]) tagr[x] = 0, reverse(ch[x][0]), reverse(ch[x][1]);
}
inline void insert(char c) {
int x = 0;
while (ch[x][1])
pushdown(x = ch[x][1]);
ch[x][1] = ++ nodes, fa[nodes] = x, w[nodes] = c == 'E';
splay(nodes);
}
inline int find(int k, int t = 0) {
if (! k) return 0;
int x = ch[0][1];
while (1) { pushdown(x);
if (k <= siz[ch[x][0]]) x = ch[x][0];
else if (k == siz[ch[x][0]] + 1) return splay(x, t), x;
else k -= siz[ch[x][0]] + 1, x = ch[x][1];
}
}
inline void update(int x, bool op) {
op ? flip(x) : reverse(x);
if (fa[x]) pushup(fa[x]);
if (fa[fa[x]]) pushup(fa[fa[x]]);
}
#define print printf ("%d %d\n", mat[ch[0][1]]. a, PLUS(mat[ch[0][1]]. a, mat[ch[0][1]]. c))
int main() {
mat[0] = {1, 0, 0, 1};
scanf ("%d%d%s", &n, &q, s+1), ch[0][1] = build(1, n), fa[0] = 0;
print;
while (q--) {
scanf ("%s", op);
if (op[0] == 'A')
scanf ("%s", op), insert(op[0]);
else {
scanf ("%d%d", &l, &r);
if (r == nodes)
update(ch[find(l-1)][1], op[0] == 'F');
else
x = find(l - 1), x = find(r + 1, x), update(ch[x][0], op[0] == 'F');
} print;
} return 0;
}
详细
Test #1:
score: 5
Accepted
time: 2ms
memory: 7864kb
input:
2000 2000 EEWEEWEEWEEEEEEEEEEEWEWWEWEWEWWEWWEEWWWWWEEWWWWEEEWWEEEEEEWEEWWWEWEEWWWEWWWEEEEEWEEWEEEEEWEWWWWEWEWWEWWWEWWEEWEWEWEEWEEEWEEEEEWWWWWEEWEEWWWWEWEEWWEWEWEWWWWEWEWEEWWWWWWEWWEWEWEWEWWWWWEWWEEEEWWEWEEWEEEWWEWWEEEWEWWEEEEEWEWEWWEWWEEWWWWEWWWEEWEWEWWEWWWWEEWWEEWEEWWWWEWWWWWEWEWWEWWWEWEWEWEWEEWEWW...
output:
236914576 427170560 455958030 792307171 350099908 643944131 30094991 244492279 664330683 672034650 196986454 826231782 811869946 57281060 428509085 286574691 242134678 343855751 575517458 916720058 924999075 813960063 502272180 732435768 429026902 548151478 117159291 713634437 994387081 908426498 11...
result:
ok 2001 lines
Test #2:
score: 5
Accepted
time: 2ms
memory: 7932kb
input:
2000 2000 EEEWEEWEWEEEEWWWWWWEWEEWEEWWWEEEEEWWWEWEWEWEEEWWWEEWWEEWWWWEWWWEEWEEWWWEEEEWEWWWWEWEEEWWEEEWWEWEEEWWEEEWEEWWEEEEEEWWWWWWWWWEEWWWEWWEEEEEEEEWEWWWEWEEEEWEEEEWEWWWWEEEEWEEEEWWEEEWWEWWEEEEEEEWWWWEWEEWEEWEEEWWWWWEEEEEEWEWEWWEWWEWWEWEWWWWWWWEWWEWWEEEWEWWWWEWWWEWWEEWWEEWWWWWWEWWWWWEEEWEWEEEWWWWEW...
output:
6463648 45329706 704854091 442597320 611518326 829511419 169746550 712178861 343598285 645073706 51850478 881313322 758347024 119308585 810197502 2377554 8347627 717938203 387334078 730560576 513033985 905117933 941437898 150747949 655470247 523903222 598663792 674651171 441573667 488014808 5663047 ...
result:
ok 2001 lines
Test #3:
score: 5
Accepted
time: 6ms
memory: 5912kb
input:
2000 2000 WEWWWWWWEWEWEEWWEEEWWWEWEEEWWEWWWWWWWEEWWEWEWEEEWEEEEEEEEWEEEWEWWEWEWEWWEEEEEWWEWWWEWWEWEWWEEWEEEWWEWEWWWEWEEWWWWEEEWEWEEWWWEEWEEEEEEWWWWWEEEWWWEWEWEWEEEWWEWWEWWWWWEWEEEWWWWEEEEWEEEWEWEWWEWWEWEEWEEEWWWEEWWWEEWEWEWEWEWEEWEWEEWWWWEEEWWEWEEWEWWEEWWWWWEWWEWEWEWWWEEEEEEEEEEEWEEEEWEEWEEWWWWEEWWW...
output:
370118869 68690813 515226007 364567815 321309070 771226105 836535077 137549567 825557266 592676526 586020561 400876265 546172140 667508517 949881892 410393758 495806013 112686580 847194282 623388482 564480425 383951352 758536622 22187248 134492891 653514182 237878375 947202223 528832941 884621310 44...
result:
ok 2001 lines
Test #4:
score: 5
Accepted
time: 1ms
memory: 5828kb
input:
2000 2000 WWWEWEWWEEEEWEEWEEWEWWWEWEWEWWWWEEWWWWWEWWEEWWWEEWWEWEWWWEWEEEWWWWWWEWWWEWEWWEEWWEWEEEEEEWWEEWWEEEEEEWWEEWEEEWEWWEEWWEEEWWWWEEEWWEEEWEWEEEWWEEEWWEEEWWWWWWEEEWEEWWEEEEWWEWWEEEEEEWWWEWWEEWEWWWEEEEWWEEEWEWEEEEWEWWWWWEWWWEEWEWEWWWWEWEEWWWEEWWEWEWEWWEEWEEEEWWWEWWEWEEWEEEEEEWEEEWEEEEWWWWEEEEWWWW...
output:
235402133 46717372 503780338 308308218 772158543 569899064 502357027 124712409 981342842 751949499 485455516 876661908 646460084 249933867 888347395 995462419 474758271 420262950 364861313 417481016 254964355 414699082 267901582 760666130 302820744 702265551 337739906 643864972 640560650 347886170 1...
result:
ok 2001 lines
Test #5:
score: 5
Accepted
time: 25ms
memory: 10800kb
input:
100000 100000 WEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWE...
output:
56136314 66655788 66655788 122792102 122792102 189447890 189447890 312239992 312239992 501687882 501687882 813927874 813927874 317371403 317371403 133054924 133054924 450426327 450426327 583481251 583481251 35663225 35663225 619144476 619144476 654807701 654807701 275707824 275707824 930515525 93051...
result:
ok 100001 lines
Test #6:
score: 5
Accepted
time: 79ms
memory: 10468kb
input:
100000 100000 WEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWE...
output:
56136314 66655788 56136314 66655788 66655788 56136314 122792102 66655788 66655788 122792102 66655788 122792102 122792102 189447890 189447890 122792102 122792102 189447890 189447890 122792102 122792102 189447890 189447890 312239992 312239992 501687882 501687882 813927874 813927874 317371403 317371403...
result:
ok 100001 lines
Test #7:
score: 5
Accepted
time: 54ms
memory: 10700kb
input:
100000 100000 WEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWEWE...
output:
56136314 66655788 66655788 122792102 122792102 189447890 189447890 312239992 312239992 501687882 501687882 813927874 813927874 501687882 317371403 813927874 133054924 317371403 450426327 133054924 583481251 450426327 35663225 583481251 619144476 35663225 654807701 619144476 275707824 654807701 93051...
result:
ok 100001 lines
Test #8:
score: 5
Accepted
time: 46ms
memory: 10820kb
input:
100000 100000 EEWWWWWEWEEWEEEWWEEEEEEWEWWEWEWEWWEWEEEWWWEWEWWEWEEEWWEEEWWWEWWEWEEEEEEEWWEWEWEEEWEEWEWWEWWWWEWWWEEEWEWWWWEWEWWEWEWEEWWWEEEEEWEWEWEEEEEWWWWEWEWWEWWEEEWWEEEEEEWEEWWWEWEWWWEWWWEWWWEEWWWWWEWEEWEWWEWWEWWEEWEWWWWEEEEWEEEWEWWEWEEEEWEWWWEWWEEWEWEWWWWWEWWWWEWEEWEWWEWWWEEEWWWEWEWEEWWEEEWEEWEWEE...
output:
463893689 482207361 133609903 435326164 597503592 917533525 63152928 401496533 660656520 320785705 723809448 722282238 786962376 125534418 512527471 847816656 238092566 571854541 750620037 421426844 264903155 270999147 777430626 120571450 44089428 391570597 821520054 512142047 865609482 903712644 90...
result:
ok 100001 lines
Test #9:
score: 5
Accepted
time: 38ms
memory: 10800kb
input:
100000 100000 EEEWWEEWEEWEWEEEWWWEWWWWEEEWWEEEEWWEWWWEEEWWEEWEEEEWWWEEWEWEEWEWEWEEEWEEEEEEEWWWWWEWWEEWEEWWEWEEEWWEWEEWEEEWEWWEEEWWWEWEEWWWWEWWEEWEEEEEWWWEEEWEWWWEWWWWEWWEWWWWWEWWWWWWEWEEWWEEWWWEWEEWEEWWEWEEEWWWWWWWWEWWWWWWWEWEWEWWEEEWEWWEWEWWWEWWEEWEEWEEEWEWEWWWEEWWEEEWWEEWEEWWWWEWWEWWWEWWWWWEEEWEEW...
output:
232304001 75907756 992889884 318082491 755231414 560257226 517572944 802431961 279914474 46362343 42256004 288537078 802841887 530711813 565183417 772886548 369780951 305354008 174378485 836065821 977220372 368533281 153354504 206354749 132330523 574888030 285685027 781242779 418015550 357886456 703...
result:
ok 100001 lines
Test #10:
score: 5
Accepted
time: 49ms
memory: 10680kb
input:
100000 100000 WWWEEWEWWWWEWEEEWWEWWEWWWEWEEEEEEWWEEWWWEWEWEEWEEEEEEWEWEEWWWWEWEEEWWWEEWEEEWWEWEWWEWEEWEEWEWWWEWWEWWEWEEWEWEWEEEWEWEWWEWEEEWEWWWEWEWEWWWWEWEWEWWEWWEEEEEWWWEEEEEWEEEEWWEWWWEWWWWWEWWWWWEWWEWWEWEEWEWEEEWEWWWEEEWWWWWWWEEWEWEWEWEWEWEEWWEEEWWWEEWEWEWWWEWEWWEWWEWEEWEEWWEEWWWEEWWWEWEWWWEWEWWW...
output:
420945641 765038584 287391171 892432660 708336812 659226891 131038100 426021122 551983741 192815353 972929382 957853937 395630670 724648168 816576311 491442399 239277599 258236630 660223240 25030861 82924528 790069445 503870169 556863676 586794697 348688768 92420513 905552444 596290682 464171767 101...
result:
ok 100001 lines
Test #11:
score: 5
Accepted
time: 196ms
memory: 10424kb
input:
100000 100000 WWEEWWWWEEEWWEEWEWWEWEWWEWWEEWWWWEEWEWWEWWEEEWEEEWEWEWWEEEWEWWWEEWEWWWWWWEWWWEWEEEEWWWEEEWEWEWEEWEEEWWWEEEEEWWWEEWWEEWEEWWEWWEEEWEEWWEEWEWWWEWWEEWWEWEWEWWEWWEWWEEEEEEEWWEEWWWEEEWWWWWEEEWWWEWWEEWWEWEWWEEEWEEEEWEWWWEWWEEWEEEEWWEWWEWEEEWEWWWEWWEEWEWWEWWWEWWEWEWWWEWWWEWEWWEWEEEEEWEWEWWWEEW...
output:
875658802 592573622 107467049 537320672 983125851 131649941 92348547 668970613 304992929 22580220 559774284 403514842 814555639 784449464 745131376 570323730 76161451 265915172 988783466 614488749 445885014 266051968 683038847 804863814 901299930 71907187 121316660 337194913 412222592 282172690 6601...
result:
ok 100001 lines
Test #12:
score: 5
Accepted
time: 169ms
memory: 10372kb
input:
100000 100000 WEEEEWWEWEWEWWEEEWWEWEWWWWEWWEEEEWEEEEWEWWWEEEWWWWWEWWWWWWWEWWEEEEWWEEEWEEWEWEEEWWEWEWWEEWEWEEWWEEEEEEEEEEWWWWEWWWWEWWWEEWEEWWWEEEEEEEWEEEWWEWEWWWEWWEEEEWEEWEEWEEEWEEWWWWWWEEEEWEEEEEWEEWEWEEEEEWEWEWEEEWEWEEEEEWEEWEEWEEWEWWEEWEWEEEEEWWEEWEWEEWEEWEWEEWEEEWEEWEWEWWWWWWWWEWEEEEWEEEWEWWEEEW...
output:
203120597 308678726 255563317 282006166 475552576 555331995 228855531 399184286 980402839 243036577 211014017 642220863 439869548 43160796 501804704 568830215 549345256 811098753 52905607 381684615 554710311 950514830 496199602 953313351 375124157 898145865 871323759 853214863 369279008 808283861 86...
result:
ok 100001 lines
Test #13:
score: 5
Accepted
time: 160ms
memory: 10532kb
input:
100000 100000 EEWWWEWWEWEWEEWWWEEWEWWWWEWWWEEWEEWEWEEWWEWWEEEWEWEEWWWEEWWEEWWEEWEEWEEEEWEWWEWEEEWWEEEWEWWEWEEEEEEEEWWWEWEEEEWEEWEWWEWWEWWWWWEWEEWWEWWEWWWWEWWEEEWWWWWWWWWWEEEEWEWWEEEWWEWEWWEEWWWEWEWWEWWWEWEEWEWWEEWWEWEEWEWEEWEWEWWWWWWWWWWEEEWWWEWWEWWEWWEWWEWWWWEEEWWWEWEEEWWEWWWEEWEEEWEWWEWWWEEWEWWWWW...
output:
294324420 215062545 103351065 218239685 333063998 865775288 569553370 221191733 541326116 319271962 790691710 937383211 41812951 557250107 832504661 496388965 232294174 690789064 374340065 892714169 606634239 585258880 838928413 277803591 717305657 500994916 105458468 697918283 822764125 200668846 7...
result:
ok 100001 lines
Test #14:
score: 5
Accepted
time: 126ms
memory: 10560kb
input:
100000 100000 EEWEEWEEEEWWEEWEEEWWEEEEWEEEEEEEWEWWEWWEEEEEEEEWWEEEWEWWWEEEWWEEWWEWEWEEWWWWWWEWEEEWEEEWWEWWWEWEWEWWEEEEEWWWWWEEEWEWEEEEEWWWWWEEEEEWEWWEWWWWWWWWEWEEWEWWEWEWWWWEWEWEWEWWEWEEWWEWEEEWWEWWWWEEEWWEWWEEWWEEEEEEWEEWEEWWWEWWWWEEWWEWWEWEEWWWEWWEEEWEEWWWWEEEEWWEEEWEWWWEWEEWWWEWWEWWEEWEWEEEWWEWWE...
output:
543150472 525576930 902631523 806216968 155976689 583695289 604370339 889096926 54519636 196254210 502913286 501655847 538920249 318554933 910756307 199344037 451432203 517898970 990352452 836453903 531028348 156764483 523136447 993218386 55920442 151738516 586948790 308502999 119732785 465267482 70...
result:
ok 100001 lines
Test #15:
score: 5
Accepted
time: 260ms
memory: 10168kb
input:
100000 100000 WWEEWWWWWEWWWWEEWWEWWEEEEWEWEEWWEEWEWWEEEWWEWWWWWWEEWEEWWEEWWEWEEWWEWWWWWEWEWWEEWEWEWEEWWEEWEEEEEWEEEWWEWWWWWWEEWEEEWWWWEEWEWWEEWEEEEWEWWWWWWWWEWWWEEWWWWEEEEEWEEWEEWEEWEEEEWEWEEWWWEEEWEEEEEEEEEWWWWEEWWWWEWWEWEWEWEEEWEEEEEEEEEWEWWWWWWWWEEWWWEWWEWWWEEWEWWWWEEEEWWWWEEEEEWEWEEWEEEWWEWWWEWE...
output:
738394504 196899806 628252315 480934203 708007509 473282308 338015471 954216511 47778627 429254466 755786136 902536774 813468733 871496311 465034254 401763956 116599775 930275954 604622887 807050782 984730644 730083742 312659278 737561376 917667427 723466314 981557837 538301601 172780314 609494287 8...
result:
ok 100001 lines
Test #16:
score: 5
Accepted
time: 207ms
memory: 10316kb
input:
100000 100000 WEWEEWEEEEEWWWEWEWWWWWWEEEWWEEWWWWWEWEWEWEWWEEWEWEEEEWWEWWWEEWEWWEEEEEEEWWEWWWEEEEWEWEEEEWEWWWWEEWWEEWEEEEWWEWEWWWWWWWEEEWWEWWWWWEWWEEWWWWWEWEWWEEWEWEEEEWEWWWWWWWWWEWEEEEEEWEEWEEEWWEWEEWEWWWEEWEEEWWWEEWEEEWWEEEWEWWWEEEEWEEWWEEWEEEWWWEEEEWWEEWEEWEWWWEWWWEWEEEWEEEEEWEWEEEEEEEWEWEEEWWWWWE...
output:
221881377 64526300 867264922 104966851 895699262 160858486 924133602 216750121 821588511 377608607 224002813 442148058 430544020 52702889 575673161 823359256 331670170 464158708 797643949 571296040 510251131 185938916 222858313 798826145 99553688 290053969 904705569 62913317 657177704 320116308 4862...
result:
ok 100001 lines
Test #17:
score: 5
Accepted
time: 274ms
memory: 10332kb
input:
100000 100000 EEWEEWWEEWWEEEWEEEEEEWEEWEWWWWEEWEEWEWEEWEEEEWWEWWEWEWEWWWEWWWWEEEEEEWWEEWWWEWWEEWWWEWWEEWWEEWWWEWEEWWEEWWEEWWEEEEEEEEWEWEEWWEEWWWWEWWEEEWWEEWEWEEEWWEEEEEWEEEEEEWEWEWWWEWWWWWWWEWEWEWEWWEWWEEWWEEEWWEEWEWWEEWWEWWWWWWWEWEWWWEEWWWEEWEWEWEEEWWWEEEEEWEEEEEEWEWWWEEWEWEEWEEWWWWEWEEWEWEEWEWWWEW...
output:
453792249 419195457 635509442 125271770 348485242 826289385 871179462 952685220 779885962 969532744 18402734 425925227 851196373 662026212 611299288 697053901 108836443 836708452 693246926 794021273 300391905 215225657 597429151 698686793 300028196 860554027 6083087 412972925 707680681 9903684 20621...
result:
ok 100001 lines
Test #18:
score: 5
Accepted
time: 213ms
memory: 10292kb
input:
100000 100000 WEWEEWWWEWWEEWEEEWEEWEEWWEWEEWEWEWWWEWWEWEWEWEEEWWEEEEWEWWEEEEWWWWEWEEEWEWEWEWWWWWEEWEEWEEWEWEEWEEWWEWWWWEEWEWEEWWWEEWEEWWWWEEWWWEEWWWEEWWWEEWWEEWEEEEWWWEWWWEEEWEWEEEEWWEWWEWEEEWWEEWWWWWWWWEWEEWWWEEEWEWEEWEWEWWWEEEWWWWEWEWEEWWEWWWWWWEWWWWWWEEWWWEEWEWEWWEWEWEWWEEWWWWWEWEEWEWEWWEEWEWWEWW...
output:
762638567 681697179 39169027 823655962 58904035 71249595 781775746 645563360 216062286 731858957 698161470 422590424 545096248 427215848 187484712 978815162 87310597 368180733 396876496 266485042 706442395 164789351 17763941 63093660 327329840 959642322 636895739 857946631 964225579 819344600 602876...
result:
ok 100001 lines
Test #19:
score: 5
Accepted
time: 142ms
memory: 10632kb
input:
100000 100000 WWEWEWWWWEWWEEEEWWEWEEEEWEWEEEWEEEWEWEWWWEEWWWWEWEEEEEWEEEEEWWEWWWWWWWWWEEEEWEEEEEEWEEWEWEWWEEEWWEEWEWWWEEEWEEEWWEEEEWEWWEEWWWEEWEEWEWWEWEWWEEEEEWWWWWWEWEWEEWEWWEEEWWEEWWWWWWEWEWWWEWWEEEWWWEWEEEWWEWWWEWEWWWWWWWEWWWEEEWEEEWEEWEEWWWWEWEWEWWEEEEWWEWWEWEEWWWEWEWEEWEWEWEEWEWEWEWEWEEWEEEEEEW...
output:
74681488 836785835 638623812 915677147 895462570 336542170 672404863 195085270 569623080 531627440 325352021 466137176 289556271 216748375 396593283 584704042 686149554 801452417 278494080 349681938 285839947 251563973 293185814 153446008 390887343 303148159 155715876 867442081 882466549 729808149 6...
result:
ok 100001 lines
Test #20:
score: 5
Accepted
time: 177ms
memory: 10348kb
input:
100000 100000 WEEEEEWWEEWEEEWEWWWWEEWWEEEWWEEEWEEWEEEEWWWEWEWWWEWWEWWEEEEWWEWEWWWWWEWEEEEEEEEWWWWEWWEEEEWWEWWWEWEWEWWWWEWEWWWWEWWWEEEWWEEWEWWEWWWEWEEEEWEWEEEWEWEWWWEEWEEWEWEEWWEEEWEWWWWEWWWEWWEWWWEEWEEEEWEWWWEEEEEEWWEEWEEEWWEEWEEEEWEEWEEEWWWWEEWEWWEWEEEEWEEEWWWWEWEEEWWEWEEWWEEWEEEWWWWEWWEEWEEEEEEEEE...
output:
585679563 527550909 301810803 97943174 184888702 250150555 764009299 13962586 892408347 983785319 771792234 757579416 242483451 785888882 459888418 99762025 271456373 608442296 967785092 643292378 48255 339129176 775700305 755289495 553108002 173205461 597638245 363923008 439206085 558514174 3859997...
result:
ok 100001 lines
Extra Test:
score: 0
Extra Test Passed