QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#427591 | #8743. 转化 | PorNPtree | AC ✓ | 7ms | 4528kb | C++17 | 4.4kb | 2024-06-01 14:03:22 | 2024-06-01 14:03:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 105, M = 1005;
int c[N], du[N];
vector<int> G[N];
vector< vector<int> > tG[N];
__int128 res[N], bc[N], Rc[N];
void dfs(int x) {
if (res[x]) return;
res[x] = -1;
for (auto v : G[x]) dfs(v);
}
void output(__int128 x) {
if (!x) return;
output(x / 10); putchar(x % 10 + '0');
}
int dfn[N], low[N], inS[N], bcc[N];
vector<int> wh[N], nG[N], rG[N];
stack<int> S;
void Tarjan(int x) {
dfn[x] = low[x] = ++dfn[0];
S.push(x); inS[x] = 1;
for (auto v : G[x]) {
if (!dfn[v]) {
Tarjan(v);
low[x] = min(low[x], low[v]);
} else if (inS[v]) {
low[x] = min(low[x], dfn[v]);
}
}
if (dfn[x] == low[x]) {
++bcc[0];
int v;
do {
v = S.top(); S.pop();
inS[v] = 0; bcc[v] = bcc[0];
wh[bcc[0]].push_back(v);
} while (v != x);
}
}
void dfsdfs(int x) {
if (bc[x] == -2) return;
bc[x] = -2;
for (auto v : nG[x]) {
dfsdfs(v);
}
}
__int128 xishu[N];
signed main() {
int n, m; scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i) {
scanf("%d", &c[i]);
}
for (int i = 1; i <= m; ++i) {
int a, k; scanf("%d%d", &a, &k);
tG[a].push_back(vector<int>{});
while (k--) {
int x; scanf("%d", &x);
tG[a].back().push_back(x);
G[a].push_back(x);
++du[x];
}
}
for (int i = 1; i <= n; ++i) {
if (c[i]) dfs(i);
}
for (int i = 1; i <= n; ++i) {
if (!dfn[i]) {
Tarjan(i);
}
Rc[bcc[i]] += c[i];
}
for (int i = 1; i <= n; ++i) {
for (auto v : G[i]) {
if (bcc[i] != bcc[v]) {
nG[bcc[i]].push_back(bcc[v]);
}
}
}
for (int i = 1; i <= bcc[0]; ++i) {
sort(nG[i].begin(), nG[i].end());
nG[i].erase(unique(nG[i].begin(), nG[i].end()), nG[i].end());
for (auto x : nG[i]) {
rG[x].push_back(i);
}
}
for (int i = 1; i <= bcc[0]; ++i) if (res[i]) {
int C = 0;
for (auto v : wh[i]) {
for (auto w : G[v]) {
if (bcc[w] == i) {
++C;
}
}
}
if (C >= wh[i].size()) {
for (auto iv : nG[i]) {
int flg = 0;
for (auto v : wh[i]) {
for (auto z : tG[v]) {
int s = 0, s2 = 0;
for (auto zz : z) {
s += (bcc[zz] == i);
s2 += (bcc[zz] == iv);
}
flg |= (s + (!!s2) >= 2);
}
}
if (flg) dfsdfs(iv);
}
}
if (C > wh[i].size()) {
int flg = 0;
for (auto v : wh[i]) {
for (auto z : tG[v]) {
int s = 0;
for (auto zz : z) {
s += (bcc[zz] == i);
}
flg |= (s >= 2);
}
}
if (flg) dfsdfs(i);
}
}
for (int i = 1; i <= n; ++i) {
if (res[i] == -1 && bc[bcc[i]] != -2) {
bc[bcc[i]] = -1;
}
}
for (int i = 1; i <= bcc[0]; ++i) {
if (bc[i] != -1) {
continue;
}
for (int j = 1; j <= bcc[0]; ++j) {
xishu[j] = 0;
}
xishu[i] = 1;
for (int j = 1; j <= bcc[0]; ++j) {
if (j != i) {
for (auto pos : wh[j]) {
for (int k = 0; k < tG[pos].size(); ++k) {
__int128 s = 0;
for (int l = 0; l < tG[pos][k].size(); ++l) {
s += xishu[bcc[tG[pos][k][l]]];
}
xishu[j] = max(xishu[j], s);
}
}
}
}
bc[i] = 0;
for (int j = 1; j <= bcc[0]; ++j) {
bc[i] += xishu[j] * Rc[j];
}
}
for (int i = 1; i <= n; ++i) {
if (res[i] == 0) puts("0");
else if (res[i] == -2 || bc[bcc[i]] == -2) puts("infinity");
else output(bc[bcc[i]]), putchar('\n');
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 4396kb
input:
100 1000 327 833 558 253 722 710 811 779 789 919 750 288 611 674 670 264 815 701 304 615 9 943 713 633 392 706 687 847 78 999 368 55 913 61 686 512 696 0 695 285 485 877 533 54 621 925 339 319 597 536 285 701 186 933 234 360 284 546 545 185 112 735 147 851 824 512 695 734 237 381 777 449 880 675 614...
output:
2155053232761438 74047065246801194391656046 965 2426374234007181537825780832913 1213187117003590768912890416691 18077896788769822849609 282467137324528482092 144623174310158582796217 2007265 67345413524067 256902392 8220875576 564934274649056963984 34480851724185745 9478024351590552882131956367 1284...
result:
ok 100 lines
Test #2:
score: 0
Accepted
time: 7ms
memory: 4360kb
input:
100 1000 419 67 836 765 105 801 89 109 677 745 664 148 719 22 617 422 362 483 748 435 244 922 129 307 166 80 740 851 422 364 757 277 322 626 671 395 21 875 774 645 727 336 958 164 105 109 371 841 276 625 154 234 632 999 597 527 793 536 927 511 169 27 289 924 982 178 859 721 430 988 603 900 917 850 5...
output:
120220501669479055473315 15027562708684881933938 1834419275962510223 895712537091260 109339909112 1668501 13667488579 208275 16135722593097685769228065065040 984846349676372422438236478 437359637273 223928134272617 874719274601 114651204747656549 258171561489562972307649041041141 834061 27334977431 ...
result:
ok 100 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
100 40 277 790 179 390 145 440 959 311 334 364 791 756 22 0 518 476 992 10 515 830 316 92 38 716 42 51 310 16 101 324 634 644 793 890 793 433 828 756 996 910 55 993 690 357 176 428 415 779 792 13 565 55 386 363 855 662 284 564 887 894 738 212 630 866 91 937 483 93 479 62 101 797 250 847 872 105 639 ...
output:
infinity 790 infinity infinity infinity infinity infinity infinity 334 infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity 38 infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity i...
result:
ok 100 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
100 40 338 5 608 722 335 92 306 237 534 205 6 503 192 304 433 960 828 352 578 658 230 413 617 603 407 208 702 31 685 443 209 848 700 453 566 971 485 13 881 213 885 849 798 979 50 866 738 126 958 494 271 754 951 739 937 470 356 374 317 903 197 762 48 105 199 104 921 974 308 609 950 130 83 188 304 526...
output:
infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity 6 infinity infinity 1225 infinity infinity infinity infinity 578 infinity infinity infinity infinity infinity infinity infinity infinity 31 infinity infinity infinity infinity 700 infinity infinity infinity inf...
result:
ok 100 lines
Test #5:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
100 40 818 149 271 956 869 50 786 402 223 295 451 708 548 973 335 51 871 118 906 911 694 175 67 700 196 5 615 100 868 978 401 348 484 974 412 213 144 110 36 620 708 657 583 435 791 954 947 646 893 790 947 699 988 314 917 797 437 616 886 769 6 179 831 781 265 206 348 539 267 529 271 695 355 556 194 3...
output:
infinity infinity infinity 956 infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity 903 infinity infinity infinity infinity infinity infinity infinity 836 infinity infinity infinity infinity ...
result:
ok 100 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
100 40 304 57 357 802 923 636 126 589 811 687 954 327 650 414 530 546 27 361 221 693 751 277 370 542 555 308 810 898 602 576 933 52 335 196 620 913 645 154 151 277 735 875 921 908 488 945 586 738 697 202 479 930 216 581 949 525 168 422 151 964 293 172 171 950 872 2 64 602 371 32 72 728 773 723 157 3...
output:
infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity 327 infinity infinity infinity infinity 27 infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity 898 infinity infinity infinity infinity infinity infinity infinity i...
result:
ok 100 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
100 40 517 196 952 233 938 175 139 908 288 845 8 476 802 511 207 76 727 759 588 322 551 101 240 893 179 461 380 158 253 589 868 301 923 485 910 282 478 837 804 387 950 810 919 813 13 327 251 467 476 252 988 887 331 396 870 139 124 751 226 679 440 919 323 168 976 869 808 880 463 928 921 256 935 248 4...
output:
infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity infinity 158 infinity infinity 868 infinity infinity infinity infi...
result:
ok 100 lines
Test #8:
score: 0
Accepted
time: 3ms
memory: 4484kb
input:
100 1000 203 490 906 794 916 370 399 136 842 750 865 587 399 472 699 802 90 693 803 0 227 837 487 186 301 40 868 862 298 4 806 855 249 978 312 591 858 810 421 969 242 205 727 100 550 645 622 607 692 259 315 140 157 203 410 852 37 706 30 634 716 605 426 966 499 66 820 284 304 984 820 24 365 327 580 9...
output:
361865269963248212 856696680691596060217346320 40298812 233250665203 12906750498055594558410205074 12006 264511499 341 76013472943419 140702362930910 26856064954999877594775762 4208089251 3019 216782668387880557967644936 6338 60054053468 1109987081214587 529075830813599767017425 17451626718557343957...
result:
ok 100 lines
Test #9:
score: 0
Accepted
time: 6ms
memory: 4528kb
input:
100 1000 307 131 400 903 703 641 753 21 902 244 1 668 994 616 469 180 189 784 334 801 443 294 419 406 857 163 538 400 132 427 138 239 717 804 694 60 756 572 680 654 575 625 360 873 511 102 220 78 694 453 9 460 699 191 262 191 623 355 232 899 292 405 152 313 88 744 504 816 528 452 840 877 842 623 88 ...
output:
7785576 2371184 885195120897372397599108 63609914183090627927103 38888846127440654840 53018598989552840881736970 578071 106366681674879106 2165354122324265321810736940124 89708940 8970302528821264715615 5752151187 35466398182684507463993921608092 4639111177235 194881222 31502288461482 36798728442896...
result:
ok 100 lines
Test #10:
score: 0
Accepted
time: 0ms
memory: 4156kb
input:
100 1000 161 366 926 540 960 49 772 226 597 473 317 56 82 539 398 765 912 481 333 111 486 229 766 602 724 935 313 305 358 716 617 223 765 376 155 715 407 155 472 912 5 756 936 7 50 275 895 91 319 474 943 41 597 419 74 32 170 909 757 370 209 130 661 231 428 562 294 222 14 968 181 337 410 604 165 338 ...
output:
4280 18397716445869310 49660254676939759 609797278365102685255 444617551977889137548879 100779905688597021801864102 176309656779919760781481481490 2020286972641967127005 16664 1005410 8322161485577151381630 4019626992292 31608215199650303 4830461568905518 875024058750458670253534 12617000 912 128100...
result:
ok 100 lines
Test #11:
score: 0
Accepted
time: 6ms
memory: 4200kb
input:
100 1000 875 97 974 549 484 156 828 778 455 130 443 360 80 138 470 108 0 998 325 512 250 788 685 542 923 511 657 736 279 954 19 654 169 761 722 794 12 119 833 623 755 823 24 754 349 425 567 320 889 62 824 671 557 622 992 33 990 171 530 682 991 94 95 119 874 580 703 858 6 723 740 659 202 760 490 256 ...
output:
917065923806673152851053313 5176021493337564514473814 370462314589520725563967308370 233520273165416 4753 418261706991775385 239175517239063784 269953198756513446551343108 5898574985151753046314904335054 3747683396610780058721367076 1956157 6815594438064559988 7733665488207095 3947288565197827542851...
result:
ok 100 lines
Test #12:
score: 0
Accepted
time: 6ms
memory: 4160kb
input:
100 1000 330 732 280 949 123 103 20 407 678 856 378 587 288 907 918 545 460 397 652 561 64 980 995 531 533 430 607 846 322 972 336 493 306 772 291 480 766 658 911 543 452 480 697 210 918 918 766 196 277 435 158 245 284 452 712 177 116 348 329 517 765 268 163 963 554 671 266 356 234 453 27 151 653 21...
output:
1796708531621823 320138474468764612 11091075 886469414841856 679308288931577589159330267 11940493602638612 135902542729373454453523677252 70446996778382685796647320395 3333772125689340473006108864277 38940407 140594192688253177050 97690168448842626 19608312900552907963360331 5786813 6314560339713277...
result:
ok 100 lines
Test #13:
score: 0
Accepted
time: 3ms
memory: 4332kb
input:
100 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 87 50 89 3 30 36 22 39 74 98 53 87 61 51 66 73 1 82 79 26 92 97 23 5 78 85 2 44 83 12 37 75...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 100 lines
Test #14:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
6 6 313 0 0 0 0 0 1 1 2 2 1 3 3 1 4 4 2 2 3 3 1 5 1 3 3 4 6
output:
313 infinity infinity infinity infinity 313
result:
ok 6 lines
Test #15:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
7 10 3 4 0 0 0 0 0 1 1 2 1 2 5 6 2 1 4 4 1 3 3 1 2 4 1 2 3 1 2 3 2 5 6 4 2 6 7 7 1 6
output:
3 7 7 7 7 14 7
result:
ok 7 lines
Test #16:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
10 12 3 0 0 0 17 0 0 0 1 0 1 2 3 6 1 2 4 7 3 1 4 4 1 2 2 2 3 8 3 2 5 6 4 2 5 7 5 2 6 7 5 2 6 8 2 1 3 7 1 5 9 2 9 10
output:
3 3 3 3 26 infinity 26 infinity 1 infinity
result:
ok 10 lines
Test #17:
score: 0
Accepted
time: 1ms
memory: 4036kb
input:
100 1000 25 729 429 0 0 0 31 0 0 942 0 0 219 0 556 0 0 0 0 0 0 0 941 0 138 983 0 0 248 856 0 230 0 0 763 937 79 0 359 0 59 90 0 990 0 575 30 0 0 0 0 0 301 0 0 0 0 752 0 606 200 0 0 0 0 131 501 0 438 708 62 0 466 0 0 0 0 847 0 0 0 223 769 110 328 0 0 0 0 232 582 388 0 369 250 0 649 642 0 0 41 1 88 50...
output:
124113 124113 318407943 8643994283 318407943 318407943 26098725 5219184 29450131892 942 8643994283 8348 318407943 124113 5219184 318407943 236866 318407943 318407943 318407943 8348 26098725 318407943 2881331408 26098725 5219184 8643994283 78868 39434 29450131892 942 39434 318407943 5219184 124113 52...
result:
ok 100 lines
Test #18:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
100 1000 0 671 283 0 0 234 0 0 949 106 672 396 617 0 305 0 0 480 319 348 957 990 0 9 0 193 752 111 795 794 201 0 353 0 0 897 0 354 707 984 85 0 206 24 229 248 377 123 0 0 0 0 0 0 0 0 261 37 576 0 481 775 0 304 0 0 0 337 0 696 187 693 0 0 0 484 619 0 0 0 0 990 617 0 347 250 849 998 627 466 768 720 0 ...
output:
infinity 3144661 infinity 225652 225652 225652 225652 12609742 1443916 6802660 225652 14109 225652 12609742 225652 225652 3918 225652 225652 225652 12609742 225652 42897 225652 225652 28788 12609742 14220 infinity 225652 6802660 225652 225652 225652 225652 255337 1443916 12609742 14109 6802660 22565...
result:
ok 100 lines
Test #19:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
100 1000 0 0 0 368 0 0 0 152 312 0 995 100 0 0 877 0 0 935 0 0 0 415 0 729 0 0 0 0 0 0 0 950 0 20 0 551 650 898 169 26 225 0 647 489 0 6 0 0 0 430 272 161 565 0 0 0 732 0 800 940 736 0 263 334 897 967 629 654 478 0 356 162 0 0 416 172 0 408 0 512 0 775 758 710 0 0 0 0 0 0 0 269 0 0 0 0 0 0 0 622 96 ...
output:
11722419 11722419 24974 46891651 2638698278472 146594343187 21002123718 25556 146594343187 46891651 5121221601 187569114 2638698278472 2930053 2930053 11722419 0 474409 2930053 46891651 21002123718 187569114 2930053 187569114 2930053 2930053 474409 24974 704807221 187569114 132515 8038 2930053 47440...
result:
ok 100 lines
Test #20:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
100 1000 0 0 561 0 74 796 0 565 0 0 602 0 600 0 856 637 38 671 0 0 0 0 0 824 991 726 616 22 320 0 0 520 0 654 584 601 0 0 0 178 732 0 0 740 0 0 556 0 0 67 960 181 638 75 11 717 351 0 0 510 0 555 0 168 180 0 176 0 398 0 0 54 0 841 857 502 0 305 0 0 0 0 0 819 0 367 0 548 0 0 0 0 222 0 0 0 590 0 831 0 ...
output:
1579201226 infinity 25593769 14868691 197399584 72611 334683 334683 334683 20109 5968766 27238014673 334683 20109 93576 4120 infinity 72611 14868691 355161 9079338057 592200774 14868691 334683 282550 25593769 25593769 20109 334683 592200774 65443698 592200774 8684537265 8684537265 166771 4120 20109 ...
result:
ok 100 lines
Test #21:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
100 1000 173 550 0 0 0 606 0 573 0 937 0 616 0 0 0 0 467 351 0 0 559 0 0 592 727 0 0 0 859 527 537 0 0 416 0 0 0 33 0 0 571 0 0 153 38 57 792 851 130 87 0 0 0 0 0 0 0 150 0 173 435 0 0 559 664 0 102 350 0 94 0 0 279 0 576 378 0 0 0 0 0 174 887 0 660 110 43 629 746 891 0 0 764 0 0 723 644 459 0 0 61 ...
output:
1507243 14255687 15686356428 403145917 28522483 125974112128 28522483 126377600779 994 772736974026 2618659450 994 1988 28522483 1988 6024 28522483 28522483 1988 2267 129854500 28522483 66010 infinity 28522483 66010 28522483 14255687 403145917 2515 411613 341438 5223007662 4523793 341438 1309329725 ...
result:
ok 100 lines
Test #22:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
100 1000 0 0 300 756 223 737 0 301 0 0 0 955 0 0 126 732 583 718 737 897 608 881 0 0 0 490 946 0 0 0 0 850 8 0 478 0 0 0 0 131 0 154 0 499 0 0 0 0 662 96 495 778 0 725 332 0 0 445 988 0 0 0 0 520 52 445 0 790 812 0 0 0 93 0 743 187 0 829 0 0 299 0 0 0 221 585 144 659 0 0 599 0 457 0 0 684 0 0 45 0 7...
output:
76141 76141 553560 50079896402572 1447 76141 1447 1544515190375 12207842043 331378 553560 infinity 76141 2894 553560 16005 514838395259 76141 1062030286 3238494170724 553560 1108791 infinity 76141 infinity 66445366485 1544515190375 1544515190375 305535055950 1544515190375 38286231 1627533612967 5148...
result:
ok 100 lines
Test #23:
score: 0
Accepted
time: 1ms
memory: 4032kb
input:
100 1000 911 586 440 0 0 725 49 0 934 329 50 0 0 5 214 0 42 746 295 227 0 0 77 0 0 0 0 0 0 0 596 849 0 430 607 345 0 894 0 620 692 0 419 0 476 0 0 370 0 888 0 0 0 0 530 0 539 0 507 0 811 831 540 255 256 337 0 0 0 741 115 0 0 0 0 0 430 68 0 0 368 25 0 215 0 465 0 847 0 780 419 0 275 612 0 0 139 481 0...
output:
30301 29390 7651533 475661 infinity 1842 240775819125 29390 4025868776 267805919 86508 240775819125 7651533 22954604 826373000 29390 7651533 30609169 563231 86735 8698 61212639 30609169 267805919 8698 infinity 30986 29390 2174863 1117133518 58181020381 29390 7651533 267805919 86508 11304 267805919 8...
result:
ok 100 lines
Test #24:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
100 1000 0 301 0 160 365 0 0 0 461 0 441 401 572 0 490 59 0 0 0 0 0 697 0 0 0 109 0 0 448 0 0 0 0 211 0 0 0 554 130 916 0 211 685 0 0 626 0 556 0 987 0 877 141 599 0 906 0 261 200 0 0 745 420 0 908 483 0 0 0 990 646 335 0 0 0 980 0 0 952 0 865 515 0 725 0 587 0 0 839 180 981 0 642 0 0 0 0 0 672 99 5...
output:
27922018512 15661416 infinity 187897 55850847716 3404670 27922018512 infinity 6533 66048734 187897 39717 3404670 2706677893 741371828607 19658 66048734 infinity 27922018512 158467 66048734 741371828607 1804458690 27922018512 483 295519077 158467 680118 171154689600 6533 2722427 158467 483 7413718286...
result:
ok 100 lines
Test #25:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
100 1000 727 0 0 4 46 837 93 0 803 0 0 0 108 0 0 432 0 0 0 0 754 0 213 263 0 0 0 0 746 0 0 302 0 0 0 0 0 482 260 0 299 0 917 563 189 582 0 0 0 0 106 0 0 171 0 0 0 0 692 778 995 0 779 606 0 808 0 287 703 991 0 0 0 501 332 0 0 0 278 691 297 783 583 0 0 454 456 0 466 0 965 0 965 0 0 122 589 0 924 231 8...
output:
5744637631534 1169147488 5744687755467 77886454 148742785355 1169147488 5525742 1914879210269 47112905667 64790 5099336054 1840938 5525742 15314585648 5525742 47112905667 15314585648 5744637631534 1840938 810279 64790 1269268650 1693 5525742 5099336054 16708220 194370 233667250 22234708 1169147488 5...
result:
ok 100 lines
Test #26:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
100 1000 0 551 0 0 0 0 0 0 0 0 0 289 0 0 58 647 792 335 364 0 232 0 957 0 412 706 341 773 0 486 0 0 0 524 0 461 212 0 0 35 799 0 86 0 0 0 0 0 500 865 0 0 233 267 18 0 145 982 0 822 531 639 0 10 592 708 0 874 0 0 0 0 0 117 931 0 301 0 0 92 424 198 0 263 719 0 0 643 0 630 0 57 842 948 0 569 0 501 0 0 ...
output:
3125333710 507946919 6252144697 8946829 230017236 12494 2957865575 infinity 9376001972 6457018 2957865575 230017236 12494 1967074 2957865575 infinity infinity 3125333710 6252144697 infinity 1505236 230017236 infinity 6252144697 12494 2957865575 12494 773 491133 1967074 230017236 12494 infinity 64570...
result:
ok 100 lines
Test #27:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
100 1000 269 323 383 106 0 408 590 0 0 0 0 0 0 28 867 0 139 0 978 0 881 0 207 248 184 669 0 0 0 953 0 0 549 365 0 400 0 0 0 362 0 910 0 0 0 312 0 0 4 0 0 911 522 0 219 994 723 0 114 928 0 0 904 910 0 0 0 329 71 95 0 646 570 947 227 0 776 0 0 0 791 542 0 0 464 0 687 817 492 349 0 478 0 0 0 0 35 0 0 1...
output:
105291965 323 infinity 105291965 105291965 infinity 6920359303910 2250785 30945 309769509066 323 105291965 233912 infinity 435361533 2250785 30945 12004684 7540 2095587630 309769509066 749794 1715 421725756554 5868 85067508937 105291965 5868 6920359303910 309769509066 2095587630 30945 2095587630 inf...
result:
ok 100 lines
Test #28:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
100 1000 587 0 781 949 0 0 0 0 0 406 500 724 0 208 967 0 777 0 0 878 812 0 0 64 185 259 0 936 0 266 287 0 0 0 0 0 135 53 244 0 845 0 0 0 0 0 0 469 992 0 503 742 0 0 578 724 0 0 494 0 735 53 0 623 225 25 572 392 375 0 0 886 0 0 0 284 765 0 329 683 0 0 0 141 430 736 0 0 0 289 0 0 980 796 0 0 281 832 8...
output:
549623 452986287 8843744 1134 infinity 166864 1134 1768346 23300104359 93200432392 1865011920 1865011920 93200432392 13350 infinity 1134 26532774 549623 54775 5711779518 166864 113204983 452986287 6571 1134 279602398054 549623 452986287 23300104359 8843744 54775 166864 8843744 1134 1865011920 932004...
result:
ok 100 lines
Test #29:
score: 0
Accepted
time: 1ms
memory: 4012kb
input:
100 1000 489 0 526 0 0 0 714 0 248 450 0 0 0 438 0 0 424 373 0 881 873 7 853 402 732 706 40 100 40 836 587 609 777 323 0 392 726 0 0 0 0 212 643 47 0 0 424 220 439 0 235 0 804 688 844 749 0 1 0 206 0 790 661 352 917 869 151 255 170 0 462 0 0 675 430 0 0 0 0 785 0 617 265 150 0 0 0 0 0 0 0 566 738 0 ...
output:
infinity 1386218631154 5548020073509 16269 1436619084 1436619084 1386792228944 infinity 581630 5352 infinity 1387075947270 106590829066 283716894 283716894 2929109 319878853388 1386792228944 213288022264 11735797854675 1436619084 283716894 2929109 144904 2929841 5548020073509 1386218631154 193387871...
result:
ok 100 lines
Test #30:
score: 0
Accepted
time: 1ms
memory: 3772kb
input:
100 1000 233 0 0 903 811 0 501 572 0 556 621 984 0 0 0 934 0 12 0 188 0 0 856 0 0 371 251 506 982 0 0 65 0 846 72 435 657 368 0 87 0 482 0 0 286 570 0 387 995 0 0 0 519 918 528 0 101 0 761 0 0 0 0 541 158 532 293 0 919 728 0 0 0 523 0 377 0 0 945 0 944 797 0 0 0 0 0 0 0 0 0 22 22 171 0 0 783 394 0 0...
output:
13965080 infinity 9616275300 2705 2705 9616275300 9616275300 1170808451 13965080 2705 3247938 9616275300 777476 9616275300 3247938 infinity 3247938 26706 0 9616275300 9616275300 9616275300 infinity 0 777476 804553 251 462160829 126376 62697 123242922 585403816 30810519 123242922 8104840 2705 388045 ...
result:
ok 100 lines
Test #31:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
100 1000 605 118 947 0 0 0 0 0 222 235 854 233 0 0 0 209 0 785 48 379 0 831 0 0 0 0 0 0 737 0 149 911 0 853 726 831 162 993 0 275 385 0 0 0 361 0 788 0 0 0 0 500 281 583 0 0 660 0 349 0 0 0 809 190 211 0 0 413 966 0 0 0 0 0 353 0 552 26 0 446 609 936 0 857 953 106 0 518 0 846 767 325 0 483 0 550 0 0...
output:
4947749276 586530 24310 24310 2299 293206 2299 2981622 infinity 78088 293206 1236932602 4950730898 11928034 2981622 293206 586530 293206 339959799 293206 24310 302319 24310 339959799 293206 339959799 24310 3737636137 3036 4947749276 1236932602 302319 2981622 2299 3737636137 293206 339959799 12369326...
result:
ok 100 lines
Test #32:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
100 1000 0 715 0 0 0 0 0 0 301 0 79 0 0 591 0 810 0 917 837 398 787 501 0 548 0 16 0 624 0 545 0 424 679 450 0 491 271 0 0 31 0 420 235 0 494 60 0 0 0 750 894 72 898 0 0 624 0 288 0 0 367 757 0 0 0 873 0 0 248 575 0 0 924 0 991 0 474 509 634 0 824 830 0 643 163 0 0 0 266 81 344 806 450 0 0 285 441 5...
output:
951304199 1425 9041 7694050795 1923512658 infinity 84649 30170339322 infinity 1923512658 infinity 951304199 infinity 951304199 infinity 951304199 30170339322 infinity 9041 infinity infinity infinity 18367 264608 67760895 9041 961756329 951304199 infinity 1323362 9041 951304199 1425 84649 84649 infin...
result:
ok 100 lines
Test #33:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
100 1000 0 965 0 53 134 0 0 0 81 155 973 0 0 0 105 0 762 0 0 160 631 0 0 999 0 0 0 0 254 0 0 236 0 64 0 0 544 143 0 0 752 302 0 617 952 0 0 297 537 0 0 0 630 852 0 0 0 0 0 0 456 0 822 0 976 591 0 774 0 880 0 0 0 84 0 195 0 261 692 0 0 0 406 449 78 0 0 210 0 0 180 715 0 716 970 216 0 0 675 0 56 1 10 ...
output:
2459155454 13064094 116482678 540830 2459155454 540830 0 540830 116482678 17844 540830 0 1083837 53335737 540830 819718353 53336499 89657 infinity 116482678 116482678 3296 819718353 17844 17844 1083837 540830 17844 13063129 17844 89657 3296 53335737 540830 1083837 infinity 1083837 89657 116482678 32...
result:
ok 100 lines
Test #34:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
100 1000 0 888 0 0 0 0 288 0 0 784 85 175 12 18 0 519 557 307 0 0 0 0 0 0 0 0 0 0 0 0 937 0 0 536 265 699 765 36 0 0 721 956 0 0 679 0 329 788 30 191 879 417 0 0 659 0 534 335 666 0 289 0 0 188 0 902 543 0 878 0 31 949 4 0 207 762 0 0 0 268 866 705 0 533 649 276 0 47 865 356 0 0 0 0 0 289 0 437 0 14...
output:
587166 587166 2936780 587166 1282 587166 42291601 12218 64075 4630 12218 12218 587166 12218 12218 12218 64075 587166 2936780 infinity infinity 8810340 1282 infinity infinity infinity 12218 4630 12218 infinity 64075 587166 12218 42291601 587166 587166 1282 84583238 1282 infinity 587166 587166 12218 5...
result:
ok 100 lines
Test #35:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
100 1000 0 218 0 0 0 563 0 456 0 0 689 294 0 819 206 0 504 0 0 263 0 123 0 0 0 0 0 190 100 430 0 0 642 0 798 168 0 0 293 726 795 0 381 0 0 0 0 966 0 232 0 0 108 280 260 603 0 0 257 0 942 0 0 221 0 0 0 405 0 206 910 0 0 653 573 233 0 0 0 619 0 0 0 0 0 771 967 0 0 418 0 951 0 879 0 0 0 0 215 0 10 1 82...
output:
6196 131071116 10060395 614 infinity infinity infinity 7284562 infinity 28162 181952 infinity 131071116 181952 infinity infinity infinity 3098 infinity 2227237 131071116 493989900 10060395 3098 131071116 20177114 7284562 181952 infinity 181952 infinity 181952 3098 20177114 10060395 181952 181952 inf...
result:
ok 100 lines
Test #36:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
100 1000 0 696 0 314 371 0 705 150 0 0 0 863 652 0 689 487 0 523 0 0 0 334 0 0 500 0 0 829 0 0 196 0 203 445 0 0 117 0 84 291 744 472 999 0 0 0 708 603 251 177 0 210 0 384 0 892 786 0 0 0 773 0 623 283 0 613 0 950 0 0 0 811 0 0 224 71 0 736 939 0 0 372 0 0 0 0 532 0 0 920 354 965 0 0 0 333 831 0 612...
output:
1281910913 84500765 84500765 1145 61235074813 1145 52880 578200 507109280 1734984 578200 578200 578200 84500765 61235074813 578200 10205845190 578200 infinity 14082717 84500765 infinity 578200 infinity 84500765 156040 578200 2056714186 774801633 1517 10205845190 10205845190 50779 42301826 169002316 ...
result:
ok 100 lines
Test #37:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
100 1000 0 310 0 0 230 0 0 0 933 142 118 0 604 448 0 0 0 461 602 0 224 528 0 0 0 0 373 0 0 0 0 0 86 32 0 0 0 0 88 778 0 0 21 0 0 0 0 786 0 822 926 352 0 316 0 0 133 0 0 0 290 677 516 630 0 0 985 0 0 0 408 882 0 0 0 0 0 403 979 0 127 0 0 0 32 0 88 0 0 508 0 0 0 398 0 0 0 0 0 172 93 1 64 74 1 30 32 1 ...
output:
3222511 23641756 infinity infinity infinity 3222511 461 infinity 1273111023 infinity infinity 312366758 infinity 1249468334 infinity infinity 1249468334 461 infinity infinity 1249468334 infinity 1249468334 1865 infinity infinity infinity 3222511 infinity 56021 3222511 85968192 312366758 infinity inf...
result:
ok 100 lines
Test #38:
score: 0
Accepted
time: 1ms
memory: 3760kb
input:
100 1000 0 0 673 0 103 400 0 0 0 79 0 0 764 0 0 596 514 17 0 252 0 899 552 0 0 0 159 0 912 0 0 229 0 0 956 0 724 0 998 163 18 0 957 0 0 617 0 0 29 680 895 0 0 680 0 774 129 21 0 206 0 683 110 309 0 754 37 596 0 0 218 0 73 858 0 601 755 561 0 0 0 0 0 220 533 710 872 0 208 332 962 5 278 208 0 589 0 10...
output:
5352434 infinity 68507 1783731 1065 infinity infinity 11763350 infinity 201592 infinity 79290 245475732 infinity infinity infinity 10846 infinity infinity infinity 1337326 10846 76707 76707 1337326 122657885 1783731 245475732 infinity 68507 infinity infinity 68507 infinity 211401 201592 1337326 infi...
result:
ok 100 lines
Test #39:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
100 1000 0 381 0 0 644 624 803 450 0 496 0 0 0 945 0 797 0 0 0 363 176 588 804 0 574 0 0 691 677 118 88 906 395 396 357 52 0 619 232 174 0 0 232 0 0 302 0 401 0 897 104 726 0 848 0 0 0 474 175 0 0 0 0 0 302 0 0 379 0 598 0 380 0 221 96 0 0 0 0 264 689 0 0 788 0 984 172 0 0 0 302 0 0 127 879 0 0 114 ...
output:
166233325556 3820 1507834055146 5867057984 8284 infinity 318774 34355 318774 3820 infinity 318774 318774 19556861561 809654 3820 3820 infinity infinity 34355 3820 166233325556 325941853 977842533 9778430308 318774 166233325556 infinity 166233325556 infinity 318774 166233325556 3820 404827 1662333255...
result:
ok 100 lines
Test #40:
score: 0
Accepted
time: 1ms
memory: 4016kb
input:
100 1000 468 281 0 0 0 0 662 0 822 566 516 0 0 0 596 118 0 0 0 0 0 0 56 142 208 432 408 0 659 0 0 572 419 0 0 0 0 0 765 0 0 318 0 625 0 683 0 0 468 535 0 334 263 0 0 0 0 266 0 0 280 525 590 408 0 0 0 202 565 0 0 879 971 0 0 0 0 939 0 0 549 0 832 219 828 51 0 644 384 114 325 0 0 0 331 0 0 0 647 385 7...
output:
741659285 6499956 3438 640 3337473475 3337473475 infinity 19521471 1624617 infinity 741659285 14036 405706 71565671 405706 3438 0 3438 71565671 6499956 71565671 6499956 3337473475 3580 3337473475 infinity 13428111519 71565671 202555 202555 50397 50397 50397 149631298 6499956 1624617 50397 71565671 i...
result:
ok 100 lines
Test #41:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
100 1000 0 0 493 619 0 900 0 0 819 136 288 0 374 899 366 299 0 645 0 0 0 524 0 0 543 387 0 0 625 0 121 245 259 0 676 679 595 353 0 951 0 865 357 628 110 810 710 0 991 0 0 0 841 0 0 0 0 452 878 0 0 0 405 0 227 556 950 0 247 0 0 0 0 954 0 0 0 0 996 467 0 0 0 672 0 325 0 45 202 963 0 0 0 449 101 395 0 ...
output:
3911736580 19764847471 31870521 24656808112 1955867840 3911736580 31870521 488906267 15852 786 488906267 240039 31870521 95852501 488906267 2409453 95852501 4819956 47881 488906267 15852 240039 488906267 infinity 31870521 infinity 2409453 95852501 488906267 47881 24167900873 4218 infinity 4218 infin...
result:
ok 100 lines
Test #42:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
100 1000 0 119 0 414 486 0 0 0 0 227 0 0 264 108 22 0 0 0 852 0 0 868 800 0 791 104 0 0 620 0 941 562 840 0 0 737 0 0 53 0 842 0 0 0 28 0 0 878 585 0 0 430 103 539 0 0 693 904 416 645 995 77 227 522 96 0 34 0 488 438 323 562 0 0 0 0 611 0 0 633 0 907 812 0 949 689 894 0 0 0 0 554 0 195 530 852 0 583...
output:
199375733 25921 16134932127 3674584 infinity 331989755 331989755 108602 33077475 145347311510 149364354469 3674584 7967930149 25921 48404797693 7192 3674584 infinity 918309 66458336 995970898 infinity 3983964533 145347311510 995970898 918309 217204 infinity 7350666 199375733 150922 260086 4017042848...
result:
ok 100 lines
Test #43:
score: 0
Accepted
time: 1ms
memory: 3772kb
input:
100 1000 0 0 743 0 933 0 918 621 0 402 763 0 368 745 0 135 232 366 0 182 486 0 0 344 0 0 0 859 605 820 23 0 118 640 990 0 339 0 0 0 956 0 0 931 0 0 74 527 0 0 0 646 0 0 591 549 205 0 0 0 618 0 0 782 5 918 922 0 0 0 945 0 58 0 705 0 0 0 736 0 0 0 218 148 945 0 0 115 0 590 141 0 476 869 849 0 0 747 0 ...
output:
3160701377 3513 790174171 78188942 2414252589 790174171 3513 infinity 246173 8278752 4276 740069 3160701377 790174171 6329682022 infinity 78188942 1736726592 infinity 2759450 infinity 3160701377 2414252589 2414252589 790174171 infinity 790175040 2759450 493896 790174171 59298 infinity 78188942 3513 ...
result:
ok 100 lines
Test #44:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
100 1000 484 0 0 0 0 845 32 0 0 722 637 281 194 487 0 0 929 303 296 692 906 0 676 237 190 0 0 0 0 0 0 0 0 0 0 795 155 0 0 697 823 0 684 0 0 0 0 0 0 0 0 207 825 0 652 304 0 121 0 0 0 0 0 0 742 0 0 0 0 972 0 0 695 0 605 0 972 566 0 247 0 0 728 0 0 279 0 0 0 0 820 364 967 260 0 477 0 927 0 320 91 9 46 ...
output:
173213 infinity 173213 9915206652 18778274 2628 infinity 9915206652 40562208264 2628 18778274 225345414 infinity 225345414 2891076 56334822 7395 9915206652 225345710 100455 696823 2628 100455 infinity 9915206652 40562208264 2891076 2891076 56334822 9915206652 2891076 225345414 9915206652 9915206652 ...
result:
ok 100 lines
Test #45:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
100 1000 265 0 400 72 0 725 0 776 0 0 0 0 0 0 0 0 876 361 681 450 75 429 0 457 388 0 0 825 887 767 0 0 229 682 301 0 0 210 326 0 0 306 424 0 0 0 681 0 895 0 0 0 0 309 0 111 613 616 0 51 0 0 53 0 715 0 399 0 50 416 16 0 363 162 0 908 427 0 0 0 0 0 525 487 461 0 354 538 0 794 169 818 0 829 0 702 829 0...
output:
infinity 80578 392817 infinity 25949 10401 701992795 156505 infinity 2419 90979 2122579292 388 392817 24898161 10401 8299160 80578 232385871 2419 101294636202 701992795 38769 101294636202 388 232385871 8299160 80578 156505 1611310 12820 392817 80578 101294636202 55124863307 18374954097 232385871 392...
result:
ok 100 lines
Test #46:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
100 1000 425 543 451 0 239 1 0 0 0 155 0 0 0 0 0 448 146 0 0 289 0 0 131 0 0 0 43 401 0 0 0 0 0 671 0 0 878 0 0 729 670 0 103 713 0 0 294 964 0 943 437 0 0 760 0 0 0 0 418 0 345 0 720 0 0 0 0 0 0 246 343 0 0 585 0 904 173 0 439 0 0 0 944 866 0 935 0 0 299 0 582 0 0 20 247 714 601 417 0 0 56 1 34 15 ...
output:
1010 245341 2888 37210114 244798 37210114 37210114 1225424 0 1225424 244798 1225424 1225424 396908946 244798 15103 49613437 3725571 infinity infinity 99226874 244798 62261543 396908946 1225424 2058966400 infinity 3431 infinity 15103 244798 3725571 1010 2096177185 2058966400 2058966400 48335 48335 in...
result:
ok 100 lines
Test #47:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
100 1000 794 0 663 559 261 512 0 552 0 595 367 349 337 953 0 0 0 0 952 0 216 399 343 0 145 966 0 702 0 497 669 410 0 0 0 690 764 0 0 116 0 0 220 0 0 0 0 309 0 0 604 206 780 0 746 0 83 796 0 267 0 0 446 523 395 479 0 0 104 861 281 0 0 0 0 0 0 0 0 925 465 0 0 0 119 0 0 0 106 544 750 0 898 355 126 330 ...
output:
5428 670637964 18628716 49083 5141567693 2220 16769990060 5141567693 55883177 10867152 1551888 10867152 186288040 55464 974 infinity 10867152 9412556 24738 2220 670637964 974 5428 589912108 974 670637964 4657195 22768936842 12418285 10867152 10867152 2220 1551888 5141567693 670637964 670637964 18628...
result:
ok 100 lines
Test #48:
score: 0
Accepted
time: 1ms
memory: 3804kb
input:
100 1000 504 347 0 0 0 0 722 0 821 0 0 15 192 0 0 10 0 0 0 832 738 124 617 24 864 955 0 0 554 146 675 0 0 270 92 0 503 0 379 882 246 0 0 0 0 923 499 694 395 0 202 0 279 588 394 356 611 0 580 492 0 0 0 719 545 857 0 0 4 0 0 877 0 759 610 744 0 104 619 0 463 0 363 0 23 0 0 0 572 0 520 768 785 0 0 496 ...
output:
1433507 42363028 170432 infinity 2122363972 4355 5619 4355 256037 974 94941 79165 5619 1570261944 1570261944 79165 4355 94941 13190 8472091 738 5619 94941 4355 170432 8472091 42363028 4049 8472091 1347398 infinity 4355 974 4049 4355 1347398 1347398 infinity 42363028 94941 8472091 4049 169453977 1694...
result:
ok 100 lines
Test #49:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
100 1000 686 0 0 0 0 802 777 0 467 588 0 584 0 0 801 595 0 0 0 0 0 927 0 604 0 765 0 0 807 0 942 0 327 911 0 13 261 801 200 890 853 123 0 145 0 6 0 0 0 0 528 802 853 0 476 712 201 0 866 0 597 312 0 475 0 0 0 0 330 0 0 0 0 981 358 853 766 961 0 0 0 801 0 0 338 0 0 0 233 56 367 0 484 967 154 213 67 0 ...
output:
97556134728 36187991 72376748 229315 3259111 36187991 5330923730 266353308 27187787181 1785 8193 583750817291 20101 5330923730 36187991 3259111 36187991 83697909142 896352 36187991 83697909142 266353308 266353308 36187991 583750817291 27187787181 83697909142 1785 36187991 6519133 108559 infinity 836...
result:
ok 100 lines
Test #50:
score: 0
Accepted
time: 1ms
memory: 4016kb
input:
100 1000 39 0 31 0 750 0 74 61 737 0 0 0 427 503 930 586 814 0 0 0 0 522 0 60 849 0 878 0 684 934 0 0 0 967 551 0 0 0 316 710 0 0 815 0 0 458 686 292 773 0 441 0 520 409 179 743 476 389 0 517 211 176 222 367 410 876 302 960 0 0 0 0 709 0 423 754 0 820 0 205 658 313 977 676 582 0 0 0 0 0 0 0 0 29 0 2...
output:
3396 1258666251 11524977 5467632 94832473 805464 2018187 225243170 1821960 98477 5343244899 2018187 11524977 5467632 402441 2018187 11524977 3396 10721357535 2018187 41052 infinity 5467632 41052 2018187 1821960 41052 1119 5129523371 99411 1821960 45567 2018187 41052 98477 infinity 3396 21442715070 4...
result:
ok 100 lines