QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#290512 | #1150. Friend | MoRanSky | 100 ✓ | 18ms | 5812kb | C++23 | 1.0kb | 2023-12-25 05:05:44 | 2023-12-25 05:05:44 |
Judging History
answer
// nm 5h 不会做。
#include "friend.h"
// Skyqwq
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long LL;
typedef pair<int, int> PII;
template <typename T> bool inline chkMin(T &x, T y) { return y < x ? x = y, 1 : 0; }
template <typename T> bool inline chkMax(T &x, T y) { return y > x ? x = y, 1 : 0; }
const int N = 1e5 + 5, INF = 1e9, M = 2e6 + 5;
int n, f[N][2];
void inline upd(int u, int v, int op) {
if (op == 0) {
f[v][1] += f[u][0];
f[v][0] += max(f[u][1], f[u][0]);
} else if (op == 1) {
f[v][1] = max(max(f[u][1] + f[v][0], f[u][0] + f[v][1]), f[u][1] + f[v][1]);
f[v][0] += f[u][0];
} else {
f[v][1] = max(f[u][1] + f[v][0], f[u][0] + f[v][1]);
f[v][0] += f[u][0];
}
}
// Find out best sample
int findSample(int nt, int C[], int H[], int OP[]){
n = nt;
for (int i = 0; i < n; i++) f[i][1] = C[i];
for (int i = n - 1; i >= 1; i--) {
upd(i, H[i], OP[i]);
}
return max(f[0][0], f[0][1]);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 1ms
memory: 3640kb
input:
2 10 20 0 0
output:
20
result:
ok single line: '20'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
3 1 1 1 0 0 1 0
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
3 10 20 15 0 0 1 0
output:
25
result:
ok single line: '25'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
3 10 21 10 0 0 1 0
output:
21
result:
ok single line: '21'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
5 7 10 7 7 9 0 0 1 0 2 0 3 0
output:
23
result:
ok single line: '23'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
5 2 7 2 2 2 0 0 1 0 1 0 1 0
output:
8
result:
ok single line: '8'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
5 7 2 2 2 2 0 0 1 2 0 0 0 0
output:
7
result:
ok single line: '7'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
6 10 1 1 1 50 100 0 0 0 0 0 0 0 1 0 0
output:
150
result:
ok single line: '150'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
6 10 100 100 100 200 1 0 0 0 0 0 0 0 1 0 0
output:
301
result:
ok single line: '301'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
5 10 9 9 10 1 0 0 0 0 0 1 0 0
output:
20
result:
ok single line: '20'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
5 10 9 9 7 1 0 0 0 0 0 1 0 0
output:
19
result:
ok single line: '19'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 73317 709653 0 0
output:
709653
result:
ok single line: '709653'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
6 24937 127961 357937 348575 518129 654241 0 1 1 2 2 1 1 1 4 1
output:
1325268
result:
ok single line: '1325268'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
5 968647 180181 765632 172039 6425 0 0 1 2 0 2 2 1
output:
968647
result:
ok single line: '968647'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
4 431041 434795 78766 235721 0 0 1 2 2 0
output:
670516
result:
ok single line: '670516'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
10 728621 357901 218760 479513 430913 902001 325661 82798 198299 530500 0 0 1 1 2 2 2 1 0 1 0 1 1 2 3 2 3 1
output:
1956283
result:
ok single line: '1956283'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
10 799888 802306 106681 297921 25978 538921 529985 698382 362393 867205 0 1 1 1 1 1 1 1 2 1 2 2 2 0 6 0 1 2
output:
3758280
result:
ok single line: '3758280'
Subtask #2:
score: 8
Accepted
Test #18:
score: 8
Accepted
time: 0ms
memory: 3580kb
input:
183 467403 351346 91715 808023 812201 39905 121879 826115 87959 599300 856785 540385 416529 151510 86425 446233 247157 209505 45551 393035 853449 439262 613665 998141 803328 306742 387756 125607 957636 623709 414351 835921 279553 457457 193251 678858 832400 298751 179976 855228 819173 450193 19161 4...
output:
92365866
result:
ok single line: '92365866'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
337 621868 907241 724218 820876 434261 854369 433704 874081 594690 30647 678799 27683 180737 689741 529053 330753 965578 205631 146004 972128 78484 726453 27686 369485 823525 466249 683780 253345 221491 556335 172921 116425 613681 600361 308132 876591 794531 276934 156033 39741 146309 898445 157201 ...
output:
169356246
result:
ok single line: '169356246'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
404 899425 56571 57253 545061 347862 562193 289505 994849 954481 824147 883379 499987 119593 226925 833433 648841 370426 12507 976545 148051 305339 821119 218247 281681 601175 99041 785262 678841 41877 636925 517957 262389 164322 785893 980506 403646 807169 743171 205399 185541 374557 808736 487607 ...
output:
202006603
result:
ok single line: '202006603'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
785 664201 663898 748993 304646 961745 467166 904979 338424 499381 685049 857051 509131 726461 791392 580382 22091 53331 234271 707381 834638 746193 210639 627141 476355 110661 151909 626415 885017 289298 74841 901421 185262 934146 816371 864458 971011 447517 138869 981899 635675 296036 51146 794158...
output:
390601703
result:
ok single line: '390601703'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
951 781351 249985 528625 33108 229033 823583 773729 415737 455918 318986 376901 895036 215505 757047 294338 73301 966953 727532 947662 737001 518864 440346 492781 731297 903051 163001 681613 856551 701527 50417 57218 761481 710311 583072 255484 186162 747322 581953 971079 482049 629061 260181 919041...
output:
460883370
result:
ok single line: '460883370'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
425 676317 916167 794091 143876 215056 558505 341141 139191 110529 846217 832995 426921 396926 859341 509540 171455 755265 129106 210967 771887 127057 580090 51641 887065 35375 658065 251043 519252 890190 169508 432853 680955 679076 823619 442942 308514 901959 688151 926881 910885 542244 740746 3243...
output:
210457492
result:
ok single line: '210457492'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
479 669828 752077 247638 785612 935165 389025 192897 367811 204449 33775 167979 520641 5731 662989 578201 815848 130956 83961 622801 606081 97341 793469 251866 455111 840855 300031 604001 827745 726405 898093 677251 80207 605997 552909 786178 561423 235523 112117 317075 566639 154001 729457 756033 5...
output:
239847499
result:
ok single line: '239847499'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
862 909064 350821 833360 992248 986197 469928 501457 437059 785023 792045 661251 680057 298709 288291 713088 393575 397231 995452 92857 632940 735393 584401 781054 652449 340832 894632 668829 663461 791052 851631 886637 669022 853601 800113 335791 569084 329003 821327 461198 569983 168855 750173 818...
output:
443801002
result:
ok single line: '443801002'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
648 694039 706741 905786 468401 652353 875295 342116 592350 916801 568312 208593 416341 519061 14986 69523 432661 596435 165195 475025 341301 588792 930504 476461 313496 532151 854569 478585 834001 886443 863024 311521 134418 516626 279841 522094 958273 451435 812751 361701 252629 247749 953889 9050...
output:
317726755
result:
ok single line: '317726755'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3736kb
input:
1000 671465 606333 309775 186226 633631 815425 570333 941295 221769 108921 966125 726505 684713 234983 397845 487297 453061 102707 936927 561129 791021 936158 612451 436769 794061 882026 985537 96996 878629 519799 574945 211435 32741 825981 664857 894849 832569 502001 904321 969281 851354 961134 141...
output:
491569528
result:
ok single line: '491569528'
Subtask #3:
score: 8
Accepted
Test #28:
score: 8
Accepted
time: 1ms
memory: 3652kb
input:
428 927513 10731 91153 630053 1961 701529 448957 194081 836151 96389 65358 962097 180366 477571 823398 317588 302522 174834 664099 782211 589961 985061 819461 19104 503837 800257 925702 192767 404451 399190 261438 318093 434001 572449 952651 925317 5513 197617 444811 147504 113629 128601 729017 1206...
output:
997650
result:
ok single line: '997650'
Test #29:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
946 548326 437441 17598 557761 681412 263911 266955 565279 225244 929307 660375 717083 99014 978488 88673 866867 315877 229845 555483 181797 314193 893536 724831 611141 199930 281241 329 300901 692171 910401 849065 230871 92495 960361 659477 292065 285833 477365 576007 188553 528251 369916 908920 79...
output:
998923
result:
ok single line: '998923'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
96 116883 551217 955833 376757 574961 857449 378829 742606 490625 20785 643738 446715 34833 587399 242117 394435 795089 439451 819471 560123 463429 471461 399513 308070 770439 693533 639111 146113 84155 918483 681743 950998 944473 848698 778111 155085 272461 540789 197181 258361 192281 363871 275323...
output:
988379
result:
ok single line: '988379'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
675 815101 701691 21345 323606 564035 380001 751205 877587 599263 552582 713931 777857 357633 530883 157801 240278 408113 712456 885419 828255 777429 806553 698529 625173 282597 797121 268821 178833 186689 904883 814833 955791 810117 711497 614746 708567 562593 649410 375200 907301 888061 316422 528...
output:
996171
result:
ok single line: '996171'
Test #32:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
934 518417 919657 300433 492031 735001 234601 458240 252076 962525 413681 947621 926401 771521 752077 760101 688129 789721 150740 524401 480321 70601 129064 74327 746879 141601 154111 303831 545778 668277 847949 974801 963989 18613 356375 441985 812941 829185 957345 576026 225913 28066 875475 977551...
output:
997891
result:
ok single line: '997891'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
20 58528 37443 3642 822481 532061 370689 480809 83712 27029 770073 202881 455933 308581 209379 404834 35368 327823 417201 450372 866626 0 2 1 2 1 2 3 2 3 2 2 2 6 2 6 2 3 2 2 2 2 2 11 2 9 2 11 2 7 2 10 2 16 2 2 2 1 2
output:
866626
result:
ok single line: '866626'
Test #34:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
268 586005 460001 323805 713321 633671 974010 634579 797551 563980 331765 353816 701257 818633 62250 974789 584183 921006 236266 574356 420201 740959 677857 403633 405905 871258 242473 661789 885055 161044 644201 740779 593024 353539 174590 419021 483409 943964 939713 300133 998517 260907 784937 371...
output:
998517
result:
ok single line: '998517'
Test #35:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
372 942363 360608 731044 658721 59205 913281 687497 291022 346513 577301 873995 803075 650837 380519 646469 791658 324438 763969 817691 527237 393151 574886 942247 706137 924101 254636 239450 68862 2255 32101 84895 589841 359366 63040 825349 188114 488481 508418 395278 511301 990798 425973 702201 47...
output:
998533
result:
ok single line: '998533'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
94 47586 749801 105261 160309 386041 738501 442662 243701 210233 825501 128179 500061 733697 296446 221367 399935 197341 413217 102549 350571 407465 632034 713651 364370 127535 211697 688273 280093 492594 92501 839997 1209 270461 176349 342853 264689 324965 979999 700312 320895 892027 746843 839431 ...
output:
997177
result:
ok single line: '997177'
Test #37:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
1000 836081 253204 389256 900201 567311 648535 293033 520177 990085 689063 902437 228984 854413 456649 212722 841217 670276 436620 207920 898290 46848 571756 284879 421873 123649 860439 809704 246959 855911 505009 642681 171581 95325 646112 111593 627261 770483 66827 883793 445200 863831 523037 9775...
output:
999411
result:
ok single line: '999411'
Subtask #4:
score: 19
Accepted
Test #38:
score: 19
Accepted
time: 0ms
memory: 3652kb
input:
2 10 20 0 0
output:
20
result:
ok single line: '20'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
3 10 20 15 0 0 1 0
output:
25
result:
ok single line: '25'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
5 7 10 7 7 9 0 0 1 0 2 0 3 0
output:
23
result:
ok single line: '23'
Test #41:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
5 2 7 2 2 2 0 0 1 0 1 0 1 0
output:
8
result:
ok single line: '8'
Test #42:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
500
result:
ok single line: '500'
Test #43:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
1000 798377 624191 806621 919544 615169 514251 10785 594917 274203 261283 367288 457681 956744 625611 946185 551180 659569 146851 897377 329853 977795 369927 940407 64794 60220 898451 227441 142785 662166 115201 133913 805335 985681 923439 499868 124787 792417 654444 661780 402625 332701 763837 9930...
output:
320096496
result:
ok single line: '320096496'
Test #44:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
149 758568 245461 597125 771849 107321 451893 758025 137611 840695 891297 181921 719651 327 292051 4225 133777 893126 288403 759795 777841 788151 921729 825903 312431 700157 731138 909745 428801 201813 800940 771834 547153 789225 109823 832376 330873 31261 264601 904241 999841 930793 861001 504701 7...
output:
51544064
result:
ok single line: '51544064'
Test #45:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
966 669461 882071 920741 806138 627807 626301 217607 204065 470998 634101 183251 477420 602236 107431 272866 13638 390579 477929 113951 737779 706181 291175 563641 317064 863941 763341 718997 345009 327213 495389 459586 189327 379006 511847 628453 489141 606807 225589 49849 9064 37901 903391 317101 ...
output:
313110967
result:
ok single line: '313110967'
Test #46:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
5 134017 426048 945689 65889 136400 0 0 1 0 2 0 0 0
output:
1082089
result:
ok single line: '1082089'
Test #47:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
338 348236 834721 685241 141033 82071 435597 216681 127891 302901 709333 65569 471911 750127 206862 433576 193048 646751 318787 350427 873014 80626 71865 990911 246403 999519 844935 472811 486801 246521 101434 308081 280901 480361 664190 646981 443785 17521 506021 692069 275671 223399 290921 914919 ...
output:
112614671
result:
ok single line: '112614671'
Test #48:
score: 0
Accepted
time: 0ms
memory: 3732kb
input:
434 395302 253241 382198 137934 75521 889727 831771 89853 220920 179942 440625 907429 271741 445489 385680 149925 612456 387135 480028 582529 650173 442367 204581 776671 179535 117553 273601 525881 172029 628466 537445 490051 954625 120537 809577 511973 910897 671209 641676 296523 651623 829513 9217...
output:
144992759
result:
ok single line: '144992759'
Test #49:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
928 322694 159671 598174 287089 718401 963094 663125 712789 277661 47530 678533 131721 35615 632845 313321 349217 838413 657399 171647 136078 306161 26060 972529 852769 134187 561093 347221 559369 261446 716661 14401 233682 822557 218356 569869 913291 394407 366001 872417 368220 251723 773569 603040...
output:
300911582
result:
ok single line: '300911582'
Test #50:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
887 560361 357345 467451 118589 261941 262039 914581 689129 160205 719173 824734 684746 523050 338826 705639 548860 710412 718401 276713 765527 296423 417183 736717 713345 108513 347394 91657 217112 28380 280809 188339 448313 603647 63480 737317 272597 434981 800285 458576 240169 639845 897625 92913...
output:
297777280
result:
ok single line: '297777280'
Test #51:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
159 191397 73713 195448 41813 120717 771537 703377 482952 863543 107067 555765 291274 895469 821151 667141 802848 947641 305365 593917 322189 257583 543201 581275 242169 120757 224526 59819 234989 749713 18700 234497 97573 370981 435056 602251 977891 705265 627508 391414 544833 296929 841103 52737 6...
output:
51681398
result:
ok single line: '51681398'
Test #52:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
913 433972 757645 111907 270609 70177 50407 358946 575885 62651 889281 39689 171105 304641 208901 618311 643407 93161 653054 378331 962277 609219 417751 198526 527691 739375 390065 503557 265600 961925 705874 378901 59365 120966 327661 843136 47821 446074 925197 34719 556819 595901 271178 830897 394...
output:
303892790
result:
ok single line: '303892790'
Subtask #5:
score: 23
Accepted
Test #53:
score: 23
Accepted
time: 0ms
memory: 3652kb
input:
2 1 1 0 1
output:
2
result:
ok single line: '2'
Test #54:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 1 1 0 0
output:
1
result:
ok single line: '1'
Test #55:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
3 1 1 1 0 0 1 0
output:
2
result:
ok single line: '2'
Test #56:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
3 1 1 1 0 1 0 1
output:
3
result:
ok single line: '3'
Test #57:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
3 1 1 1 0 1 1 0
output:
2
result:
ok single line: '2'
Test #58:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
3 1 1 1 0 0 1 1
output:
2
result:
ok single line: '2'
Test #59:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
5 1 1 1 1 1 0 0 0 0 0 0 0 0
output:
4
result:
ok single line: '4'
Test #60:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
5 1 1 1 1 1 0 0 0 0 0 0 0 1
output:
3
result:
ok single line: '3'
Test #61:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
500
result:
ok single line: '500'
Test #62:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1000
result:
ok single line: '1000'
Test #63:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
448 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
278
result:
ok single line: '278'
Test #64:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
541 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
340
result:
ok single line: '340'
Test #65:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
402 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
257
result:
ok single line: '257'
Test #66:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
950 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
579
result:
ok single line: '579'
Test #67:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
446 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
287
result:
ok single line: '287'
Test #68:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
475 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
299
result:
ok single line: '299'
Test #69:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
33 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 3 1 4 0 0 1 1 0 2 1 5 0 3 1 5 0 3 1 8 1 9 0 3 0 3 1 16 1 3 1 16 0 16 0 1 0 13 1 15 1 18 1 14 1 22 1 20 0 27 0 14 0 2 0 25 0 31 0
output:
21
result:
ok single line: '21'
Test #70:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
299 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
183
result:
ok single line: '183'
Test #71:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
9 1 1 1 1 1 1 1 1 1 0 1 1 1 2 0 0 0 0 0 3 0 4 1 4 0
output:
6
result:
ok single line: '6'
Test #72:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
793 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
505
result:
ok single line: '505'
Test #73:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
635
result:
ok single line: '635'
Subtask #6:
score: 31
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Test #74:
score: 31
Accepted
time: 0ms
memory: 3632kb
input:
2 10000 10000 0 0
output:
10000
result:
ok single line: '10000'
Test #75:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
3 1 1 1 0 0 1 0
output:
2
result:
ok single line: '2'
Test #76:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
6 10 100 100 100 200 1 0 0 0 0 0 0 0 1 0 0
output:
301
result:
ok single line: '301'
Test #77:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
3 10 21 10 0 0 1 0
output:
21
result:
ok single line: '21'
Test #78:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
5 10 9 9 7 1 0 0 0 0 0 1 0 0
output:
19
result:
ok single line: '19'
Test #79:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
3 10 20 15 0 0 1 0
output:
25
result:
ok single line: '25'
Test #80:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
6 10 1 1 1 50 100 0 0 0 0 0 0 0 1 0 0
output:
150
result:
ok single line: '150'
Test #81:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
5 7 10 7 7 9 0 0 1 0 2 0 3 0
output:
23
result:
ok single line: '23'
Test #82:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 2 7 2 2 2 0 0 1 0 1 0 1 0
output:
8
result:
ok single line: '8'
Test #83:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
5 10 9 9 10 1 0 0 0 0 0 1 0 0
output:
20
result:
ok single line: '20'
Test #84:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
5 7 2 2 2 2 0 0 1 2 0 0 0 0
output:
7
result:
ok single line: '7'
Test #85:
score: 0
Accepted
time: 18ms
memory: 5812kb
input:
100000 530 5377 3922 132 6508 1954 1102 4452 3414 6378 8712 2752 7827 5562 2330 8837 6810 2630 1554 9826 6656 452 3732 6438 5882 7850 7319 3752 9402 732 5727 8144 3602 3666 6497 7998 9811 2020 8055 691 254 1582 8013 765 9602 4398 5482 3420 5812 68 5808 4752 7224 8426 6010 9584 8926 3682 3602 1299 47...
output:
234893835
result:
ok single line: '234893835'
Test #86:
score: 0
Accepted
time: 9ms
memory: 4812kb
input:
50237 3135 1802 8847 7602 7158 6627 752 7960 3203 1222 5662 8600 4898 8650 7682 1012 6622 8714 8766 8713 7223 4301 8727 4362 6602 1998 9810 2230 3748 8386 8118 3794 8050 3655 2302 2942 2014 6402 8536 5214 6770 4722 7347 6690 7032 9192 7942 8768 7034 3962 2662 4079 8095 8910 2536 692 5329 4415 6842 8...
output:
118515365
result:
ok single line: '118515365'
Test #87:
score: 0
Accepted
time: 15ms
memory: 5620kb
input:
89378 1054 8034 4114 2485 7294 4586 4962 6834 8456 122 4002 5354 1690 6564 414 5232 9873 5044 2462 1654 2697 382 6748 8070 4342 4238 6259 1410 4522 9614 4493 664 4940 1682 1960 8416 1490 8152 2898 3522 3532 1227 9554 6047 9260 867 4802 8856 590 4216 6452 287 3923 9982 9771 5670 3607 6338 2530 8920 9...
output:
212300541
result:
ok single line: '212300541'
Test #88:
score: 0
Accepted
time: 16ms
memory: 5624kb
input:
89525 4972 6452 8512 754 9222 92 6356 3144 5290 1960 8851 2791 2835 9598 6818 9506 2038 4460 4004 340 4254 6722 4238 9842 5604 6154 6978 5729 2614 7842 5002 4161 8154 8542 4772 1316 1349 9902 9003 4874 2310 2282 9224 1892 9344 7552 8717 2062 5877 9202 1297 1216 7278 5372 1502 7522 3183 4364 5717 488...
output:
211664928
result:
ok single line: '211664928'
Extra Test:
score: 0
Extra Test Passed