Statistics

Problem Statement for "RedChart"

Problem Statement

Coder rankings rise and fall; not everyone who gets into the "red" stays there. For the TopCoder web site, we need to draw a chart that shows the time and duration of red ranking for each coder, but we want to minimize the size of the chart. Our chart will have horizontal bars to show the span (series of consecutive TopCoder events) where each coder has a red ranking.

For example, we might have the following coders who are "red" for a series of SRMs indicated. These spans are inclusive.

  • Coder "L" is red from SRM 97 to SRM 104, drops in ranking, and then is red again from SRM 110 to 119
  • Coder "Z" is red from SRM 107 to SRM 110
  • Coder "B" is red from SRM 100 to SRM 109

       11111111111111111111
    99900000000001111111111  SRM numbers (vertical)
    78901234567890123456789
    LLLLLLLL  ZZZZ         | Actual chart area; two lines, and SRM range
       BBBBBBBBBBLLLLLLLLLL| of 97 to 119 gives 23 columns.  Area = 2*23 = 46.

The length of the coder's handle does not impact how the graph is drawn. Single letter handles are used in this example for clarity; the desired answer would be the same no matter how long the handles were.

There are a few simple rules that govern where we can list a coder in the chart.

  • If a coder is red for a consecutive set of events, from SRM x to SRM y, they must occupy a single horizontal row in the chart from x to y.
  • A coder may have multiple spans in which they are red, but the spans do not need to occupy the same horizontal row ("L" above is an example of this). The spans for a coder must be separated by at least one SRM; thus, a span for coder "Z" from 107 to 110, and a second span from 111 to 115 will not be allowed by the constraints on the input.
  • No two coders can overlap in any position, but they may be adjacent (as is shown for "B" and "L" in the example).

To minimize area, we need to minimize the number of rows in the chart. Create a class RedChart that contains a method area that takes a String[] coders; each element of coders contains a coder handle and the start and end SRM numbers of a span for which the coder is "red." The method returns an int representing the total area of the chart.

Definition

Class:
RedChart
Method:
area
Parameters:
String[]
Returns:
int
Method signature:
int area(String[] coders)
(be sure your method is public)

Constraints

  • coders will contain between 0 and 50 elements inclusive.
  • Each element of coders will be at most 50 characters long.
  • Each element of coders will consist of the alphanumeric coder handle ('a'-'z', 'A'-'Z', and '0'-'9' are the only allowed characters), followed by a single space, the SRM number for the start of a span, another single space, and the SRM number for the end of a span.
  • Each coder handle will contain between 1 and 46 characters, inclusive.
  • The SRM numbers will not have leading zeros.
  • The SRM numbers will be integers between 1 and 1000000 (inclusive).
  • The start of an SRM span will be less than or equal to the end of an SRM span.
  • The spans for a coder must be separated by at least one SRM.

Examples

  1. {"L 110 119", "Z 107 110", "B 100 109", "L 97 104"}

    Returns: 46

    This is the illustrated example.

  2. {"A 1 10", "B 11 20", "C 21 30", "D 1 30"}

    Returns: 60

  3. {"Abcdefg 1 3", "Abcdefg 5 6", "xyzzy 1 6"}

    Returns: 12

  4. {"C0 289383 320269","C1 692777 729692","C2 747793 786128","C3 885386 945878","C4 516649 558070","C5 202362 292389","C6 368690 388749","C7 897763 911689","C8 180540 263966","C9 89172 144908","C10 5211 100579","C11 702567 758996","C12 465782 487312","C13 722862 787985","C14 174067 177202","C15 513929 593731","C16 634022 657080","C17 133069 231236","C18 961393 979849","C19 175011 253053","C20 176229 253602","C21 484421 529340","C22 413784 512321","C23 575198 669522","C24 798315 862685","C25 566413 569939","C26 776091 845071","C27 759956 801829","C28 806862 906032","C29 906996 1000000","C30 702305 723230","C31 477084 513411","C32 660336 686841","C33 750846 772575","C34 661313 687170","C35 616124 670019","C36 819582 820127","C37 898814 932181","C38 515434 605798","C39 344043 357793","C40 171087 197895","C41 117276 164454","C42 695788 789372","C43 705403 708054","C44 392754 405153","C45 999932 1000000","C46 549676 643044","C47 947739 957751","C48 636226 734812","C49 348094 445633"}

    Returns: 5968740

  5. {"C0 140795 221365","C1 651434 711812","C2 97467 164068","C3 710097 722999","C4 573317 643809","C5 926652 987408","C6 997301 1000000","C7 724286 733727","C8 953865 983554","C9 228444 275063","C10 558440 603169","C11 958031 966148","C12 738097 743868","C13 834481 925156","C14 120709 219636","C15 704567 782423","C16 179497 251850","C17 254586 331551","C18 455306 519989","C19 406219 434843","C20 51528 84399","C21 805732 854561","C22 409503 439522","C23 258270 321638","C24 959708 1000000","C25 226340 244489","C26 747796 748519","C27 142618 144863","C28 122846 216297","C29 892921 936476","C30 192379 289867","C31 537764 625992","C32 469841 562191","C33 165193 206693","C34 757034 844798","C35 470124 495038","C36 936987 1000000","C37 373743 420234","C38 322227 370592","C39 709859 791795","C40 151432 203983","C41 316437 415665","C42 153275 228682","C43 901474 977595","C44 468858 563253","C45 36029 97266","C46 908235 982028","C47 65818 160246","C48 366143 397154","C49 335928 375457"}

    Returns: 7711776

  6. {"C0 318776 341180","C1 964443 1000000","C2 114613 169151","C3 118606 155446","C4 2904 47722","C5 235128 305816","C6 797369 865286","C7 569917 636913","C8 43324 131067","C9 259470 271653","C10 298490 393989","C11 689772 696497","C12 385644 441234","C13 617505 685644","C14 502954 572740","C15 907669 945751","C16 308542 397006","C17 110197 149704","C18 759355 788159","C19 376348 454959","C20 573622 601450","C21 949299 1000000","C22 195746 231314","C23 354340 409762","C24 23311 37121","C25 267605 289406","C26 425661 499391","C27 44878 56183","C28 229320 308056","C29 79444 128070","C30 648522 651987","C31 586708 660124","C32 408282 421540","C33 412924 480561","C34 442062 447686","C35 962600 994636","C36 433452 445351","C37 419379 464929","C38 947468 1000000","C39 900973 988104","C40 903881 988811","C41 808933 854827","C42 158660 228823","C43 657199 745180","C44 548899 601895","C45 152959 166732","C46 272813 312481","C47 187190 268285","C48 952926 969392","C49 365084 376424"}

    Returns: 6979679

  7. {"C0 422090 449774","C1 443376 498918","C2 755936 835043","C3 517445 537201","C4 669179 687597","C5 706887 796299","C6 103348 135520","C7 451659 513668","C8 402336 427546","C9 166342 233929","C10 878206 897507","C11 697713 765085","C12 575321 576576","C13 864819 909418","C14 517721 547625","C15 955939 995750","C16 73940 89607","C17 311705 357933","C18 811127 840277","C19 565984 662642","C20 763920 853144","C21 602422 669691","C22 821396 875477","C23 645630 685714","C24 679292 691264","C25 207672 281522","C26 647625 653010","C27 741222 780521","C28 306640 312682","C29 783898 824611","C30 352298 408488","C31 280524 323114","C32 688209 696790","C33 288819 388155","C34 937732 1000000","C35 495994 513998","C36 160379 175148","C37 85273 167049","C38 668850 716105","C39 721860 770002","C40 575579 621463","C41 421993 445198","C42 867621 947188","C43 962504 1000000","C44 801961 864715","C45 31326 85585","C46 518944 547146","C47 613202 636708","C48 936784 938805","C49 222842 313710"}

    Returns: 5812050

  8. {"C0 789528 824717","C1 608872 658780","C2 849958 860456","C3 448036 466844","C4 457753 544001","C5 383303 416636","C6 132133 153781","C7 772890 872644","C8 517567 569313","C9 690368 709897","C10 514500 552546","C11 473788 523585","C12 66249 153239","C13 273303 276336","C14 505363 517860","C15 910253 1000000","C16 247686 266811","C17 761152 775148","C18 245975 255163","C19 649157 652886","C20 895436 927896","C21 253414 297335","C22 870460 896764","C23 60028 148055","C24 278050 344798","C25 707556 716458","C26 504794 602491","C27 858699 929742","C28 301039 333041","C29 90428 96831","C30 144500 145181","C31 617647 626185","C32 36159 131310","C33 522535 604669","C34 104339 176031","C35 502215 518342","C36 720504 776133","C37 60049 151013","C38 298285 334714","C39 495343 571678","C40 903177 906077","C41 885238 893209","C42 416949 477238","C43 495367 513355","C44 392292 478087","C45 40743 93887","C46 102829 161219","C47 961682 1000000","C48 553541 554110","C49 453826 528058"}

    Returns: 8674578

  9. {"C0 172261 228303","C1 690360 699477","C2 228023 294784","C3 81 26390","C4 903190 998615","C5 618996 625363","C6 214677 218911","C7 730690 762316","C8 764524 790581","C9 349614 422782","C10 328205 418563","C11 726312 773698","C12 565100 569446","C13 602726 637720","C14 204916 261468","C15 325578 419107","C16 528946 561236","C17 302647 359617","C18 799051 818131","C19 799631 818224","C20 830857 849484","C21 541312 603198","C22 439214 527569","C23 193512 213602","C24 14412 73891","C25 909610 968579","C26 966189 1000000","C27 806355 853996","C28 356620 382053","C29 198987 276875","C30 498338 522904","C31 487770 515054","C32 56856 147273","C33 300606 372866","C34 125849 126086","C35 107205 180264","C36 35217 83735","C37 34945 125728","C38 436873 465331","C39 710873 778510","C40 804289 824772","C41 826607 897085","C42 772757 822071","C43 334471 380200","C44 591100 624559","C45 723618 813056","C46 58025 69413","C47 633074 664307","C48 518157 551838","C49 3493 63851"}

    Returns: 6999440

  10. {"C0 550270 560969","C1 633417 635256","C2 275569 343932","C3 92622 121416","C4 413173 433020","C5 196431 213893","C6 456682 496072","C7 504292 550083","C8 205057 260172","C9 391521 487678","C10 888574 920065","C11 401947 464898","C12 359231 394252","C13 610537 704277","C14 485054 499084","C15 554098 589423","C16 241081 328597","C17 653516 686518","C18 372231 418370","C19 261796 347200","C20 582338 656918","C21 519218 558239","C22 513970 553832","C23 784812 820191","C24 894977 987662","C25 31536 131440","C26 324176 357659","C27 279207 378966","C28 984857 1000000","C29 593499 663410","C30 20127 84077","C31 505236 582796","C32 367818 442923","C33 810563 850612","C34 421244 509955","C35 41805 61739","C36 563291 640666","C37 558955 652569","C38 133589 177357","C39 828993 873911","C40 552805 629687","C41 844822 921804","C42 326717 350747","C43 593093 604667","C44 530126 616719","C45 781486 831739","C46 850543 853617","C47 327814 362527","C48 478179 516556","C49 474762 490537"}

    Returns: 6859118

  11. {"C0 727088 760007","C1 935710 942442","C2 110294 121311","C3 400346 460581","C4 871137 916828","C5 305153 329096","C6 122573 188901","C7 300925 350216","C8 306710 400728","C9 277217 314053","C10 596963 672018","C11 387090 450948","C12 378130 393034","C13 698571 771232","C14 369633 459318","C15 304789 317862","C16 722604 779455","C17 419805 469055","C18 767868 804371","C19 109485 148491","C20 82195 96834","C21 62949 84069","C22 80967 161193","C23 686763 774440","C24 290596 354577","C25 740865 828425","C26 539036 566991","C27 367770 401288","C28 359211 425553","C29 322532 367728","C30 272379 299700","C31 858270 953254","C32 384172 478599","C33 344234 396274","C34 647283 717355","C35 307398 353228","C36 901063 971410","C37 966950 1000000","C38 250573 304287","C39 886059 943581","C40 134047 160971","C41 945082 1000000","C42 271232 300436","C43 622954 653397","C44 411898 457384","C45 875640 959918","C46 89159 139421","C47 679262 768945","C48 561041 600889","C49 141723 150047"}

    Returns: 7496416

  12. {"C0 26272 75394","C1 454154 481489","C2 335821 373278","C3 909365 912112","C4 591171 602947","C5 160269 185487","C6 938701 960404","C7 914653 924586","C8 450907 504866","C9 356728 419534","C10 515797 564517","C11 547084 568392","C12 515334 558032","C13 110991 187367","C14 798898 851613","C15 801052 826223","C16 218189 289748","C17 752506 806516","C18 709016 787240","C19 173109 189648","C20 490000 523378","C21 58109 103162","C22 955081 1000000","C23 671338 677327","C24 59426 87493","C25 785147 860370","C26 776787 809018","C27 696532 788654","C28 591281 615156","C29 884850 975029","C30 576590 578844","C31 215350 226481","C32 973813 1000000","C33 381494 480675","C34 146081 200684","C35 15720 68153","C36 887982 978163","C37 97487 156902","C38 79296 148121","C39 765404 804126","C40 796892 847443","C41 230297 320329","C42 399134 442315","C43 898506 988921","C44 767057 866765","C45 380595 440594","C46 501962 514259","C47 687483 763259","C48 80154 149131","C49 191309 233896"}

    Returns: 7874248

  13. {"C0 139932 163314","C1 895021 939287","C2 313563 322423","C3 903682 912893","C4 277685 346771","C5 564285 655215","C6 735990 830573","C7 197314 248790","C8 754116 849936","C9 641892 679417","C10 395528 434367","C11 897525 995015","C12 651136 652496","C13 889618 937261","C14 170337 251265","C15 506582 533203","C16 804310 822265","C17 370888 405113","C18 426815 501385","C19 543437 564290","C20 460008 467730","C21 811783 824133","C22 418657 427754","C23 363827 452953","C24 621269 643340","C25 726651 759800","C26 60910 101438","C27 430639 459037","C28 241888 278498","C29 992393 1000000","C30 433890 532866","C31 755199 809751","C32 416931 443018","C33 388777 448876","C34 400657 449223","C35 580952 657969","C36 72641 165376","C37 89368 180666","C38 918184 971379","C39 696776 752581","C40 975266 998694","C41 588954 641482","C42 80308 99901","C43 297278 319475","C44 372555 462227","C45 250774 257219","C46 305000 327325","C47 560997 599280","C48 648412 714539","C49 598382 663803"}

    Returns: 8451819

  14. {"C0 914693 994027","C1 942439 1000000","C2 88421 136580","C3 994985 1000000","C4 1354 93115","C5 578762 671734","C6 631541 699257","C7 561852 573702","C8 703662 779144","C9 550399 626616","C10 665154 666327","C11 399015 485521","C12 839851 916215","C13 724790 813053","C14 942491 965663","C15 570037 643574","C16 18859 47687","C17 360871 368151","C18 576987 632843","C19 146590 224931","C20 563970 589322","C21 587665 683176","C22 893069 942586","C23 907361 920444","C24 41351 115463","C25 189300 195806","C26 291638 296305","C27 709364 740853","C28 581032 615186","C29 136104 175979","C30 273679 279820","C31 413412 505950","C32 734969 825605","C33 916170 928126","C34 162844 225604","C35 406649 433463","C36 304465 398779","C37 922326 936212","C38 660183 706222","C39 826969 828504","C40 320152 352773","C41 924393 936183","C42 637289 687398","C43 259631 294304","C44 584264 679999","C45 774548 848843","C46 101877 106190","C47 666833 720031","C48 994949 1000000","C49 665155 722948"}

    Returns: 7989176

  15. {"C0 678468 766624","C1 400960 483893","C2 98823 122109","C3 213171 288529","C4 185677 225817","C5 493245 515426","C6 572761 606751","C7 150323 160373","C8 84100 94054","C9 461075 529439","C10 322042 357666","C11 42659 66578","C12 456289 482133","C13 293469 344707","C14 841551 916527","C15 125383 145402","C16 63133 89476","C17 19304 81260","C18 365981 398456","C19 953666 1000000","C20 788967 835879","C21 90192 151921","C22 380902 437770","C23 88131 153133","C24 683174 732381","C25 649718 654934","C26 301183 393560","C27 945487 1000000","C28 434573 473530","C29 725062 801187","C30 713933 780730","C31 312496 405914","C32 893141 941294","C33 971726 1000000","C34 596980 622373","C35 843485 929433","C36 372305 422335","C37 264029 333588","C38 206898 259058","C39 734562 740986","C40 417719 501999","C41 411641 430543","C42 593010 666490","C43 992726 1000000","C44 628789 662929","C45 303708 346431","C46 600938 633495","C47 152493 162924","C48 980710 1000000","C49 785905 863595"}

    Returns: 5884182

  16. {"C0 49613 79004","C1 963638 1000000","C2 79421 107088","C3 207829 210500","C4 96180 154923","C5 209095 222994","C6 843024 880112","C7 749154 801540","C8 10569 68801","C9 979969 1000000","C10 492373 492403","C11 498433 508096","C12 932587 999866","C13 620094 649743","C14 291499 313850","C15 7339 64803","C16 551742 639072","C17 312086 359601","C18 231349 251264","C19 950186 994067","C20 495011 570645","C21 874133 928520","C22 812722 836009","C23 806773 846416","C24 881519 968261","C25 495354 585598","C26 103124 113263","C27 16259 68322","C28 677418 713771","C29 981712 1000000","C30 558705 564109","C31 342733 369532","C32 992734 1000000","C33 774315 814750","C34 691087 731940","C35 100669 103119","C36 916487 991289","C37 556837 602399","C38 598089 661699","C39 585205 681165","C40 666704 763615","C41 402557 472386","C42 623403 642219","C43 321892 322713","C44 571522 575127","C45 302443 349022","C46 325361 386889","C47 273378 307825","C48 332700 396745","C49 574882 598669"}

    Returns: 5955972

  17. {"C0 804899 880450","C1 242589 263975","C2 650353 749779","C3 966948 1000000","C4 163036 231542","C5 277107 323199","C6 665417 745081","C7 115921 204741","C8 98480 152646","C9 105994 192348","C10 774123 782560","C11 832933 932417","C12 86317 92629","C13 933931 952948","C14 186709 211874","C15 959156 1000000","C16 217069 218814","C17 712995 780417","C18 1171 97466","C19 148569 229128","C20 264801 290477","C21 26652 73223","C22 105340 164265","C23 251743 271915","C24 613091 687180","C25 906527 910093","C26 798878 854690","C27 3050 88246","C28 362124 415457","C29 304213 369399","C30 478499 541869","C31 56794 152362","C32 465115 551256","C33 79342 161981","C34 482437 526700","C35 663198 726788","C36 169939 176141","C37 226513 318144","C38 865128 943385","C39 511804 606375","C40 352346 387029","C41 898138 949363","C42 190495 208035","C43 36421 105393","C44 387226 427860","C45 134158 199883","C46 120356 211308","C47 77645 163117","C48 993446 1000000","C49 568111 643994"}

    Returns: 9988300

  18. {"C0 417603 465264","C1 255825 343367","C2 470216 552555","C3 379174 414518","C4 960596 967926","C5 846267 875561","C6 342013 402770","C7 980519 1000000","C8 194650 227942","C9 117832 199708","C10 390279 442269","C11 963953 974588","C12 959295 1000000","C13 96107 148848","C14 714937 795507","C15 944976 977516","C16 444584 445385","C17 720083 734883","C18 199492 215101","C19 766496 842936","C20 22939 35702","C21 505735 587039","C22 389873 392479","C23 930164 1000000","C24 52251 116600","C25 682751 725281","C26 816339 863043","C27 953165 1000000","C28 688302 753927","C29 761079 780670","C30 262547 284954","C31 568484 575615","C32 939561 944480","C33 621931 660984","C34 420528 508955","C35 815494 875313","C36 517543 555124","C37 841123 864891","C38 840187 927826","C39 524643 617081","C40 851988 859382","C41 851320 936000","C42 854098 858584","C43 993018 1000000","C44 886463 940561","C45 494695 543705","C46 976505 1000000","C47 856142 872208","C48 868098 962523","C49 571472 576450"}

    Returns: 8793558

  19. {"C0 382853 469819","C1 764797 781545","C2 224547 246819","C3 840516 921602","C4 409912 475071","C5 989877 1000000","C6 572553 613750","C7 962932 1000000","C8 162035 217986","C9 518107 566605","C10 710049 739203","C11 713861 716767","C12 592334 662337","C13 635325 712109","C14 564428 571225","C15 781763 845396","C16 110115 156675","C17 880381 931395","C18 185185 206082","C19 432100 527197","C20 602408 640737","C21 373349 464662","C22 295879 348513","C23 634316 692230","C24 808585 877360","C25 22765 57751","C26 197930 234556","C27 237892 244508","C28 306629 396198","C29 799752 887161","C30 596366 677881","C31 367395 390228","C32 644428 692204","C33 73847 103460","C34 485026 507326","C35 941062 944848","C36 960629 991392","C37 295100 351608","C38 683397 712813","C39 230775 322757","C40 114544 168084","C41 43320 72146","C42 506518 604083","C43 651794 681293","C44 187134 238680","C45 716908 816761","C46 33062 117365","C47 522686 616528","C48 848432 944966","C49 539807 589617"}

    Returns: 5863416

  20. {"C0 618834 699703","C1 453596 549411","C2 827984 876680","C3 352324 363706","C4 194465 293916","C5 519716 545077","C6 869343 932380","C7 654187 730048","C8 360602 366583","C9 705360 769448","C10 273879 312499","C11 363941 387234","C12 22924 109552","C13 17135 104843","C14 483162 540104","C15 753870 755866","C16 554163 561629","C17 197811 296311","C18 472515 539002","C19 926234 1000000","C20 682290 728240","C21 8693 60326","C22 525339 588219","C23 927494 929787","C24 485213 518067","C25 466382 541826","C26 571475 601798","C27 98738 109489","C28 716951 732824","C29 14811 31276","C30 189168 257849","C31 334813 394496","C32 492499 541476","C33 674535 739549","C34 115464 116233","C35 148346 162453","C36 563072 636463","C37 865740 954151","C38 852623 862210","C39 7057 44893","C40 458793 532232","C41 613281 659901","C42 820114 848485","C43 657371 710789","C44 860596 949130","C45 769883 819647","C46 473567 478264","C47 825800 891867","C48 153674 154009","C49 447433 532923"}

    Returns: 8936496

  21. {"C0 617457 629589","C1 615949 696478","C2 785523 867213","C3 785292 823439","C4 307629 399978","C5 492335 558757","C6 782140 804108","C7 313043 315298","C8 850339 937105","C9 172025 182961","C10 191653 249913","C11 277052 342272","C12 562957 582161","C13 631287 664270","C14 119540 198261","C15 534826 571823","C16 707205 774332","C17 433878 526606","C18 665169 684339","C19 647227 720025","C20 11520 51083","C21 739221 832881","C22 277883 346499","C23 912267 940490","C24 55382 139674","C25 355511 402546","C26 542553 575116","C27 428608 450470","C28 251768 311663","C29 371198 458858","C30 654968 677344","C31 141009 203182","C32 89503 164390","C33 371254 425927","C34 794057 812538","C35 243823 265752","C36 674396 757440","C37 631942 684222","C38 68012 112221","C39 596855 636602","C40 144854 197220","C41 403134 406893","C42 101281 133023","C43 341973 411374","C44 891638 904809","C45 273413 336371","C46 651899 666321","C47 941484 999239","C48 505661 534751","C49 528780 544851"}

    Returns: 5926320

  22. {"C0 363923 436526","C1 138000 176320","C2 272000 341942","C3 506952 546964","C4 830504 834311","C5 979759 1000000","C6 572525 655419","C7 179117 269275","C8 214636 235726","C9 59560 82186","C10 750614 783587","C11 201937 220802","C12 263748 307169","C13 176620 246029","C14 488863 494263","C15 101832 154618","C16 478004 517837","C17 407458 473814","C18 526127 540537","C19 606368 662999","C20 534569 620697","C21 848341 871787","C22 485374 512832","C23 813605 813615","C24 64901 138066","C25 838989 870856","C26 722490 763416","C27 250732 336970","C28 700699 744404","C29 272000 361562","C30 165457 239289","C31 42348 85809","C32 130017 179824","C33 426169 498666","C34 880569 913107","C35 529128 544267","C36 135018 212488","C37 38585 58977","C38 921280 989822","C39 836754 839287","C40 241707 317450","C41 834400 914950","C42 233021 234506","C43 466788 500508","C44 545190 600330","C45 639634 650281","C46 145325 227308","C47 870461 962155","C48 648142 744772","C49 964191 1000000"}

    Returns: 5768496

  23. {"C0 845520 938840","C1 976554 1000000","C2 387142 418634","C3 600930 609352","C4 900034 937719","C5 327308 385402","C6 629780 691488","C7 138644 201446","C8 279545 301329","C9 796522 837609","C10 376925 413082","C11 51735 90337","C12 634492 673040","C13 830296 929282","C14 251530 262370","C15 844049 941100","C16 320512 357468","C17 77589 85243","C18 868448 963320","C19 532428 600910","C20 632557 708645","C21 426576 488913","C22 537797 603017","C23 125139 158833","C24 687005 725019","C25 674782 755064","C26 390523 433392","C27 135236 160251","C28 681417 763301","C29 340353 389652","C30 792724 793478","C31 546350 559586","C32 37710 78002","C33 337242 343400","C34 335164 421187","C35 674641 742362","C36 762111 779680","C37 746410 762670","C38 182790 270692","C39 149955 236102","C40 825916 867005","C41 482781 499220","C42 583958 601975","C43 757806 823181","C44 99901 114412","C45 714674 723652","C46 315265 392642","C47 38566 91542","C48 917669 1000000","C49 259134 311967"}

    Returns: 5773746

  24. {}

    Returns: 0

  25. { "foo 888888 888999", "bar 333333 455555" }

    Returns: 555667

  26. { "A 10 20", "B 20 30" }

    Returns: 42

  27. { "foo 888888 999999" }

    Returns: 111112

  28. { "A1 200000 1000000", "B1 200000 300000", "C1 200000 500000", "D1 500001 1000000", "B1 300002 1000000", "A2 200000 1000000", "B2 200000 300000", "C2 200000 500000", "D2 500001 1000000", "B2 300002 1000000", "A3 200000 1000000", "B3 200000 300000", "C3 200000 500000", "D3 500001 1000000", "B3 300002 1000000", "A4 200000 1000000", "B4 200000 300000", "C4 200000 500000", "D4 500001 1000000", "B4 300002 1000000", "A5 200000 1000000", "B5 200000 300000", "C5 200000 500000", "D5 500001 1000000", "B5 300002 1000000", "A6 200000 1000000", "B6 200000 300000", "C6 200000 500000", "D6 500001 1000000", "B6 300002 1000000", "A7 200000 1000000", "B7 200000 300000", "C7 200000 500000", "D7 500001 1000000", "B7 300002 1000000", "A8 200000 1000000", "B8 200000 300000", "C8 200000 500000", "D8 500001 1000000", "B8 300002 1000000", "A9 200000 1000000", "B9 200000 300000", "C9 200000 500000", "D9 500001 1000000", "B9 300002 1000000", "A0 200000 1000000", "B0 200000 300000", "C0 200000 500000", "D0 500001 1000000", "B0 300002 1000000" }

    Returns: 24000030

  29. { "qq 1 1000000", "qw 2 999999", "qe 3 999998", "qr 4 999997", "qt 5 999996", "qy 6 999995", "qu 7 999994", "qi 8 999993", "qo 9 999992", "qp 10 999991", "wq 11 999990", "ww 12 999989", "we 13 999988", "wr 14 999987", "wt 15 999986", "wy 16 999985", "wu 17 999984", "wi 18 999983", "wo 19 999982", "wp 20 999981", "eq 21 999980", "ew 22 999979", "ee 23 999978", "er 24 999977", "et 25 999976", "ey 26 999975", "eu 27 999974", "ei 28 999973", "eo 29 999972", "ep 30 999971", "rq 31 999970", "rw 32 999969", "re 33 999968", "rr 34 999967", "rt 35 999966", "ry 36 999965", "ru 37 999964", "ri 38 999963", "ro 39 999962", "rp 40 999961", "tq 41 999960", "tw 42 999959", "te 43 999958", "tr 44 999957", "tt 45 999956", "ty 46 999955", "tu 47 999954", "ti 48 999953", "to 49 999952", "tp 50 999951" }

    Returns: 50000000


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: