Statistics

Problem Statement for "OlympicsBroadcasting"

Problem Statement

You are running a TV network that has the rights to transmit the olympic games. The network is going to create several channels that transmit events of the games continuously. A few rules have been established for these new channels:

  • Each event cannot be transmitted on more than one channel
  • Any part of an event may be included in the scheduled programming, even if the beginning and/or the end of it are excluded, but at most one interval of the event can be shown
  • Each channel must have a continuous transmission

You will be given the schedule of the olympics in 2 int[]s begin and end, with the ith element of begin and end representing the starting and ending time of the ith scheduled event in a special time unit (each interval contains both endpoints, see examples for further clarification). The duration of the games is exactly totalUnits of this time units, which means that the transmission of all the created channels must start at time 0 and end at time totalUnits. Return the maximum number of channels that can be created while satisfying these network policies.

Definition

Class:
OlympicsBroadcasting
Method:
getMaxChannels
Parameters:
int[], int[], int
Returns:
int
Method signature:
int getMaxChannels(int[] from, int[] to, int totalUnits)
(be sure your method is public)

Constraints

  • begin will have between 1 and 50 elements, inclusive.
  • begin and end will have the same number of elements.
  • totalUnits will be between 1 and 1000000000 (109), inclusive.
  • Each element of begin and end will be between 0 and totalUnits, inclusive.
  • The ith element of end will be greater than the ith element of begin.

Examples

  1. {0,1,1,1,0}

    {2,2,3,3,3}

    3

    Returns: 2

    We can make 2 channels: Event with index 0 from time 0 to time 2 and event 2 from 2 to 3. Event with index 4 from time 0 to time 3.

  2. {0}

    {1000}

    1000

    Returns: 1

  3. {0,1,2,3,4}

    {1,2,3,4,5}

    5

    Returns: 1

  4. {1}

    {2}

    2

    Returns: 0

  5. {0}

    {1}

    2

    Returns: 0

  6. {0,4,8}

    {3,9,12}

    12

    Returns: 0

    There is no way to cover the 3-4 interval.

  7. {0,1,2,3,4,1,2,3,4,5,0,1,2,3,4,1,2,3,4,5,0,1,2,3,4,1,2,3,4,5,0,1,2,3,4,1,2,3,4,5,0,1,2,3,4,1,2,3,4,5}

    {1000000000,1000000000,1000000000,1000000000,1000000000, 999999999,999999999,999999999,999999999,999999999, 999999998,999999998,999999998,999999998,999999998, 999999997,999999997,999999997,999999997,999999997, 999999996,999999996,999999996,999999996,999999996, 999999995,999999995,999999995,999999995,999999995, 999999994,999999994,999999994,999999994,999999994, 999999993,999999993,999999993,999999993,999999993, 999999992,999999992,999999992,999999992,999999992, 999999991,999999991,999999991,999999991,999999991}

    1000000000

    Returns: 5

  8. {0}

    {1000000000}

    1000000000

    Returns: 1

  9. {1}

    {999999999}

    999999999

    Returns: 0

  10. {0}

    {999999999}

    1000000000

    Returns: 0

  11. {56345324,0}

    {1000000000,56345324}

    1000000000

    Returns: 1

  12. {56345329,0}

    {1000000000,56345334}

    1000000000

    Returns: 1

  13. {0,346324623}

    {546324623,999999999}

    999999999

    Returns: 1

  14. {0,446324623}

    {446324624,999999999}

    1000000000

    Returns: 0

  15. {14160657,0,14160657,0,304684884,304684884,304684884,772218450,0,14160657,0,0,0,772218450,14160657,0,0,14160657,772218450,14160657,14160657,14160657,0,304684884,304684884,14160657,772218450,0,304684884,772218450,304684884,0,0,772218450,14160657,0,0,772218450,0,14160657,14160657,0,14160657,304684884,304684884,304684884,0,14160657,14160657,0}

    {772218450,14160657,934092412,304684884,934092412,934092412,934092412,934092412,934092412,304684884,14160657,304684884,772218450,934092412,934092412,14160657,304684884,772218450,934092412,304684884,304684884,772218450,304684884,934092412,934092412,934092412,934092412,934092412,772218450,934092412,934092412,304684884,772218450,934092412,772218450,304684884,14160657,934092412,934092412,934092412,934092412,304684884,934092412,934092412,772218450,934092412,772218450,304684884,772218450,934092412}

    934092412

    Returns: 18

  16. {140721151,140721151,0,565465226,0,140721151,0,0,0,0,446215566,565465226,140721151,0,140721151,140721151,0,446215566,0,0,446215566,140721151,0,0,140721151,565465226,0,565465226,0}

    {565465226,565465226,446215566,771306659,565465226,771306659,140721151,446215566,140721151,140721151,565465226,771306659,565465226,140721151,446215566,771306659,771306659,565465226,140721151,140721151,565465226,771306659,446215566,140721151,771306659,771306659,771306659,771306659,565465226}

    771306659

    Returns: 10

  17. {0,0,181125145,0,177462779,289951958,177462779,177462779,0,0,177462779,177462779,0,181125145,177462779,0,0,177462779,181125145,177462779,0,181125145,0,0,289951958,177462779,0,181125145,0,177462779,177462779,0,177462779,177462779,177462779,0,177462779,177462779,181125145,289951958}

    {177462779,289951958,289951958,363801824,363801824,363801824,363801824,289951958,289951958,181125145,363801824,289951958,177462779,363801824,363801824,181125145,363801824,289951958,289951958,289951958,181125145,289951958,363801824,363801824,363801824,289951958,363801824,289951958,363801824,363801824,289951958,177462779,363801824,289951958,363801824,181125145,363801824,181125145,289951958,363801824}

    363801824

    Returns: 15

  18. {0,310206756,310206756,0,310206756,0,435344402,0,310206756,0,310206756,423829804,310206756,0,0,310206756,423829804,310206756,310206756,310206756,310206756,0,0,435344402,0,0}

    {561727863,435344402,435344402,310206756,435344402,310206756,561727863,310206756,423829804,435344402,435344402,435344402,435344402,435344402,310206756,435344402,561727863,435344402,423829804,561727863,435344402,561727863,561727863,561727863,423829804,561727863}

    561727863

    Returns: 8

  19. {99002469,0,0,34638504,0,44507324,34638504,0,0,34638504,34638504,44507324,34638504,34638504,0,0,99002469,34638504,0,34638504,0,0,99002469,99002469}

    {101071605,99002469,34638504,44507324,34638504,101071605,44507324,44507324,99002469,101071605,44507324,99002469,99002469,99002469,34638504,101071605,101071605,101071605,99002469,44507324,44507324,34638504,101071605,101071605}

    101071605

    Returns: 8

  20. {219769340,0,0,893445975,0,59613849,59613849,0,219769340,0,0,59613849,59613849,0,0,219769340,59613849,0,893445975,0,219769340,0,59613849,219769340,0,0,893445975,0,219769340,219769340,0,0,0,893445975,0,0,59613849,0,0,59613849,0,59613849,0,0,0,59613849,893445975,0,59613849,59613849}

    {893445977,59613851,893445977,953311545,953311545,893445977,953311545,59613851,953311545,893445977,953311545,893445977,953311545,59613851,59613851,893445977,219769342,219769342,953311545,219769342,953311545,219769342,893445977,893445977,59613851,219769342,953311545,893445977,893445977,893445977,953311545,953311545,953311545,953311545,59613851,219769342,953311545,219769342,953311545,953311545,59613851,893445977,219769342,219769342,893445977,953311545,953311545,953311545,893445977,953311545}

    953311545

    Returns: 20

  21. {0,0,0,0,196926738,0,196926738,0,327105196,196926738,0,196926738,196926738,196926738,196926738,196926738,402005728,196926738,327105196,0,402005728,196926738,327105196,402005728,0,196926738,0,327105196,0,196926738,0,196926738,196926738}

    {327105198,196926740,196926740,959721073,402005730,327105198,402005730,196926740,402005730,959721073,196926740,327105198,959721073,959721073,327105198,959721073,959721073,402005730,959721073,327105198,959721073,402005730,959721073,959721073,327105198,327105198,196926740,959721073,402005730,959721073,402005730,959721073,402005730}

    959721073

    Returns: 12

  22. {0,0,311471069,0,311471069,460344660,84186464,84186464,84186464,0,311471069,0,0,0,0,84186464,84186464,0,84186464,311471069,84186464,0,0,84186464,84186464,0,84186464,460344660,84186464,460344660,84186464,460344660,0,0}

    {311471071,460344662,460344662,84186466,460344662,823287917,823287917,311471071,823287917,823287917,460344662,823287917,460344662,823287917,311471071,311471071,311471071,311471071,823287917,460344662,823287917,84186466,823287917,823287917,311471071,311471071,823287917,823287917,311471071,823287917,460344662,823287917,460344662,823287917}

    823287917

    Returns: 14

  23. {0,61350665,59756983,59756983,0,0,59756983,54210717,54210717,54210717,54210717,54210717,61350665,0,59756983,61350665,59756983,0,0,54210717,59756983,59756983,54210717,59756983,54210717,59756983,59756983,54210717,0,0,59756983,54210717,54210717,54210717,54210717,0,0,0,0}

    {54210719,66483836,61350667,66483836,61350667,66483836,66483836,61350667,66483836,59756985,59756985,61350667,66483836,61350667,61350667,66483836,66483836,66483836,59756985,66483836,61350667,61350667,66483836,66483836,61350667,66483836,61350667,61350667,66483836,66483836,66483836,66483836,66483836,59756985,59756985,54210719,66483836,59756985,54210719}

    66483836

    Returns: 12

  24. {0,67256875,67256875,301254970,67256875,67256875,301254970,67256875,67256875,0,0,67256875,0,67256875,67256875,0,0,301254970,67256875,348768780,67256875,0,67256875}

    {67256877,713117142,713117142,348768782,713117142,348768782,713117142,713117142,348768782,301254972,348768782,348768782,67256877,348768782,301254972,301254972,348768782,348768782,348768782,713117142,713117142,348768782,348768782}

    713117142

    Returns: 7

  25. {545081757,622475861,545081757,868815950,1,545081757,545081757,1,1,1,545081757,1,545081757,545081757,545081757,1,1,622475861,868815950,545081757,1,545081757,1,545081757,1,1,1,545081757,868815950,545081757,868815950,1,1,1,1,1,622475861,545081757,868815950,545081757,1,1,545081757,622475861,1,868815950,1,1,1,545081757}

    {622475859,971974143,868815948,971974143,545081755,868815948,868815948,868815948,971974143,971974143,971974143,868815948,868815948,868815948,622475859,622475859,545081755,868815948,971974143,971974143,868815948,868815948,622475859,622475859,868815948,545081755,622475859,868815948,971974143,868815948,971974143,868815948,545081755,545081755,971974143,545081755,868815948,868815948,971974143,868815948,622475859,545081755,622475859,971974143,868815948,971974143,545081755,545081755,868815948,868815948}

    971974144

    Returns: 0

  26. {1,271541409,555266496,1,695416615,1,555266496,271541409,1,555266496,695416615,271541409,695416615,555266496,555266496,1,271541409,271541409,555266496,555266496,271541409,1,271541409,695416615,695416615,1,555266496,555266496,271541409,695416615,1,271541409,1,695416615,555266496,1,1,271541409,271541409,271541409,555266496,555266496,555266496,271541409,555266496}

    {695416613,752441001,695416613,752441001,752441001,752441001,695416613,752441001,555266494,695416613,752441001,695416613,752441001,695416613,752441001,695416613,752441001,752441001,752441001,695416613,752441001,555266494,695416613,752441001,752441001,695416613,695416613,695416613,752441001,752441001,695416613,695416613,752441001,752441001,752441001,695416613,271541407,752441001,752441001,752441001,752441001,695416613,695416613,695416613,752441001}

    752441002

    Returns: 0

  27. {0,0,631244,21924,0,6176,0,3268541,0,5980931,300554,1388424,7542998,3241601,861231,3429216,8348387,0,8250987,0,9003570,8479929,0,0,1838544,1235796,6933665,441960,0,3362470,3060735,4954864,0,0,911246,7076260,0,3463020,0,6568752,8498412,7313019,5215093,7622375,2659131,7289996,402973,1977966,2417878,6603050}

    {3953176,6227764,3723276,559855,1722865,783924,9855876,4052080,5209061,8621984,5000958,5237556,8049941,3318539,1889876,9730144,9855876,301298,9855876,8767212,9792665,9855876,9571252,1534195,7137055,9396088,8391688,9855876,1850368,4309988,7132540,9855876,9855876,2010177,7684121,9355036,2001845,7684299,6623069,9855876,9381971,9855876,5429560,9855876,6971924,7328294,434736,2632064,8080653,9855876}

    9855876

    Returns: 11

  28. {15991293,26036795,40533603,58331629,0,74024955,33098245,24133797,92469903,18667492,0,17611208,28762331,0,34675916,6458942,11012933,90783110,47873724,75771809,2173541,49493022,0,14518084,24004355,11753387,0,2716966}

    {38646794,92970435,93678999,93678999,93678999,77957245,88753664,28016272,93678999,51717643,63355357,80315909,69290181,73831407,86914784,11974925,93678999,93678999,93678999,86222934,84684867,86233361,79516671,53029571,26428084,20225865,45024644,82287400}

    93678999

    Returns: 5

  29. {0,0,0,0,75245198,92058458,231506388,7501823,171453353,342906563,25717468,224828777,0}

    {488076976,15003928,752680697,839865047,355256717,839865047,839463884,245581285,578631056,502592743,773282033,692086357,721733330}

    839865047

    Returns: 2

  30. {376651344,279276593,402955365,221644088,0,477707243,606000653}

    {458217652,563078822,465199753,450642044,376746808,713127039,719494839}

    719494839

    Returns: 1

  31. {0,785833,0,71701132,0,85074164,113910255,46622899,0,975997,243937028,0,32402557,0,0,34665563,0,75947617,53165084,196559189,0,135079696,261624667,0,0,299259330,245438860,13261665,314069721,0,270013120,134037603,0,57230421,184226922,90836194,4257018,350492198,95186485,294980717,124337808,0,120745520,32915720,0}

    {36842879,338573528,436276094,110286562,337238748,224597514,395047629,261623452,43717556,407248655,257097716,1525735,436276094,317852011,337046362,134668698,176030594,230500665,132720850,255545213,141246539,149089197,298532975,426518851,336675376,436276094,323693038,90864913,389684459,24380943,384183375,154617592,436276094,137616874,436276094,158805467,236538915,436276094,173608938,436276094,268128129,270603714,358570643,126813344,14037604}

    436276094

    Returns: 7

  32. {310024769,256605232,256605232,0,310024769,256605232,310024769,256605232,333308901,333308901,256605232,0,0,333308901,256605232,256605232,0,0,0,310024769,0,310024769,0,0,0,0,256605232,256605232,0,256605232,256605232,310024769,310024769,0,0}

    {349400023,333308900,333308900,333308900,349400023,349400023,349400023,333308900,349400023,349400023,310024768,333308900,256605231,349400023,310024768,349400023,310024768,310024768,310024768,333308900,333308900,349400023,310024768,310024768,349400023,256605231,310024768,349400023,310024768,333308900,349400023,349400023,349400023,310024768,349400023}

    349400024

    Returns: 0

  33. {4054442,0,0,4054442,24449690,4054442,4054442,0,0,4054442,35105651,35105651,0,0,0,4054442,4054442,4054442,0,4054442,0,4054442,0,4054442,4054442,4054442,0,35105651,35105651,35105651,24449690,0,0,24449690,4054442,4054442,24449690,0,4054442,0,24449690,4054442,0,4054442,24449690,0,24449690,0,4054442,24449690}

    {35105649,36594627,4054440,35105649,36594627,35105649,35105649,36594627,35105649,35105649,36594627,36594627,35105649,36594627,35105649,36594627,35105649,24449688,36594627,24449688,36594627,35105649,36594627,36594627,24449688,24449688,24449688,36594627,36594627,36594627,35105649,24449688,35105649,36594627,24449688,35105649,35105649,35105649,24449688,35105649,36594627,24449688,36594627,35105649,35105649,4054440,36594627,35105649,35105649,35105649}

    36594627

    Returns: 13

  34. {0,0,0,0,0,29686186,0,108131125,0,0,108131125,108131125,0,0,0,0,29686186,108131125,108131125,0,0,29686186,108131125,108131125,108131125,0,29686186,29686186,29686186,0,0,29686186,29686186,160772268,29686186,108131125}

    {820911127,160772266,820911127,29686184,108131123,108131123,160772266,820911127,160772266,108131123,820911127,820911127,29686184,29686184,160772266,29686184,160772266,160772266,160772266,108131123,29686184,820911127,820911127,820911127,160772266,29686184,108131123,820911127,160772266,820911127,820911127,160772266,108131123,820911127,160772266,160772266}

    820911127

    Returns: 11

  35. {404650126,0,153122002,153122002,153122002,0,0,0,404650126,0,0,0,0,153122002,0,153122002,625670445,0,404650126,0,0,0,404650126,153122002,0,153122002,0,0,153122002,153122002,404650126,153122002,0,153122002,404650126,153122002}

    {706439117,706439117,625670443,625670443,706439117,153122000,404650124,625670443,625670443,404650124,706439117,153122000,706439117,706439117,404650124,625670443,706439117,153122000,625670443,625670443,706439117,404650124,706439117,706439117,706439117,404650124,153122000,706439117,404650124,706439117,706439117,625670443,404650124,625670443,706439117,404650124}

    706439117

    Returns: 13

  36. {466037875,0,0,12593607,466037875,466037875,490562021,0,12593607,466037875,466037875,490562021,0,12593607,12593607,466037875,12593607,12593607,466037875,490562021,0,466037875,466037875,12593607,12593607,12593607,0,0,12593607}

    {546264694,546264694,12593605,546264694,490562019,546264694,546264694,466037873,466037873,490562019,546264694,546264694,466037873,546264694,466037873,490562019,490562019,546264694,490562019,546264694,12593605,490562019,490562019,466037873,490562019,546264694,12593605,466037873,490562019}

    546264694

    Returns: 4

  37. {1870187,0,0,0,0,17837027,20139049,22253972,47066049,0,41667063,0,49907371,20287800,0,0,0,1870187,20610778,22253972,5004688,8715541,0,28219482,0,0,12860594,30534732,47066049,30534732,30534732,0,0,34995222,20287800,0,34995222,22754192,34995222,30534732,41199093,0,40130896,0,5004688,5004688,0,47066049,46738830,0}

    {22754190,46244927,12860592,29151739,12860592,30534730,50084064,40130894,50084064,28219480,50084064,47066047,50084064,50084064,8715539,36717470,50084064,20287798,50084064,28219480,20610776,29151739,17837025,37984872,36688097,36717470,45772433,50084064,50084064,45772433,50084064,34995220,50084064,41199091,40130894,50084064,39166055,50084064,41199091,46709781,50084064,50084064,50084064,22253970,50084064,50084064,22253970,50084064,50084064,41199091}

    50084064

    Returns: 16

  38. {201402186,40969701,0,23472663,70532878,45266430}

    {205954834,42693410,205954833,62200672,205954834,99595132}

    205954834

    Returns: 1

  39. {0,0,0,150661542,473316481,317531029,0,473316481}

    {939532394,939532394,939532394,939532394,889528865,939532394,403644994,636385738}

    939532394

    Returns: 4

  40. {66565608,106794488,28368534,106794488,66565608,0,0,0,28445432,28445432,83450574,95279620,366667,26534144,141385051,66565608,0,0,0,15004209,28445432,0,0,366667,0,28445432,0,0,0,0,0,102087456}

    {158498618,114082604,158498618,158498618,141385049,93540317,158498618,85824745,158498618,158498618,158498618,102087454,121046840,158498618,158498618,98097968,102087454,158498618,102087454,98097968,155827373,66565606,158498618,141385049,69623279,148466892,158498618,28445430,93540317,28368532,85824745,158498618}

    158498618

    Returns: 13

  41. {544957593,611224596,0,75708985}

    {793484121,793484121,593856155,198784281}

    793484121

    Returns: 1

  42. {42608465,10961386,4595747,0,0,0,19224721,51354316,0,24939241,48311734,0,14325101,50313595,24842880,0,0,30190172,14325101,0,50313595,0,48311734,1386810,170832,0,51051370,0,48311734,10805109,0,0,0,51051370,58067307,20612666,0,0,30190172,10805109,0,41177077,50313595,30419416,0,0,0,0,0,0}

    {51051370,20612666,19224721,51354316,48311734,30419416,36543464,63780858,24842880,63780858,63780858,24842880,63780858,63780858,63780858,41177077,63780858,63780858,63780858,63780858,51354316,48288297,57612567,19410598,10805109,51051370,63780858,55291173,51051370,63780858,16557759,51354316,25343233,63780858,63780858,63780858,10805109,30419416,63780858,24883989,57612567,57612567,63780858,55291173,63780858,55291173,41177077,24883989,20612666,24883989}

    63780858

    Returns: 17

  43. {0,9961495,27936097,81474108,0,0,138765406,60822254,392888719}

    {350226623,335941458,350226623,889603363,971638469,946566490,946566490,91365398,971638469}

    971638469

    Returns: 2

  44. {0,31113475,4408198,4408198}

    {64508548,46499438,44073867,91126084}

    108718204

    Returns: 0

  45. {0,0,4584743,15773684,6840613,6840613,4584743,3391108,11642349,0,10375479,6840613,0,3391108,490571,0,226385,0,23338876,26569815,0,0,490571,4584743,34399745,3391108,27418265,11864337,0,3391108,0,0,22871537,11642349,0}

    {46499386,46499386,46499386,28624095,11642349,15327840,23338876,46499386,46499386,26569815,27418265,46499386,41005535,15327840,15268398,6657709,7425505,46499386,26569815,41005535,15327840,46499386,10375479,15773684,46499386,36183786,46499386,46499386,4584743,46499386,36183786,30374843,34399745,46499386,46499386}

    46499386

    Returns: 12

  46. {0,0,0,233949069,272668377,91047910,83710919,0,0,117560489,466599333,167147393,32859539,491284918,0,528313941,0,0,491284918,84993391,83710919,167147393,555541507,0,528313941,119039873,448200907,0,440133748,803539628,0,84993391,0,0,0,187849177,0,386886850,272668377,83710919,117560489,406282860,0,879511938,466599333,153226796,91047910,119039873}

    {891243791,331248394,83710919,701247790,891243791,186085544,451212830,891243791,451212830,331248394,879511938,233949069,891243791,803539628,32859539,891243791,83710919,119039873,555541507,891243791,91047910,790627195,790627195,701247790,701247790,555541507,891243791,66098780,663949046,891243791,891243791,119039873,167147393,491284918,66098780,331248394,701247790,528313941,330630970,803539628,891243791,701247790,466599333,891243791,790627195,790627195,891243791,891243791}

    891243791

    Returns: 13

  47. {14,0,12,5,0,12,17,0,9,0,7,0,13,0,10,0,11,2,0,9,0,0,15,12,0,9,0,0,11,0,7,15,17,10,0,12,4,0,12,0,5,15,5,9,7,5,9,6,15,13}

    {18,12,15,15,18,18,18,9,16,18,18,12,18,18,12,18,17,9,16,16,5,5,18,18,5,15,15,12,18,18,18,18,18,18,15,16,5,9,17,18,12,16,15,18,15,9,14,14,18,18}

    18

    Returns: 17

  48. {2,2,2,0,3,2,2,0,0,0,0,0,1,3,3,2,0,0,0,2,1,1,0,0,1,2,0,1,2}

    {4,3,4,2,4,4,4,2,1,2,2,2,2,4,4,3,1,2,3,4,4,2,4,1,2,3,1,4,4}

    4

    Returns: 12

  49. {0,3,1,2}

    {3,4,3,3}

    4

    Returns: 1

  50. {1,2,0,2,0,2,6,4,0,0,1,2,0,3,0,3,2,3,4,6,3,1,2,0,3,4,2,0,0,0,3,4,2,4,0,6,0,1,0,4,5,1,3,1,0,2,3,1}

    {7,4,6,6,6,8,8,5,4,5,3,6,4,7,1,8,4,8,8,8,4,2,8,1,4,5,7,6,6,1,6,8,6,6,3,8,2,4,4,8,7,8,8,4,2,3,6,6}

    8

    Returns: 12

  51. {0,2,2,7,1,2,0,4,2,3,7,0,1,4,3,2,2,8}

    {3,3,3,8,6,10,6,6,11,11,10,10,8,7,4,11,8,11}

    11

    Returns: 3

  52. {0,4,0,2,0,0,0,1,0,0,0,2,5,4,4,5,1,0,0,0,0,4,0,3,0,0,0,0,0,3,2,2,0,0,5,0,2,1,0,0,5,0,0,0,0,0,2,0,1,5}

    {6,6,4,6,5,6,3,3,6,6,6,6,6,6,6,6,6,6,6,6,6,5,2,6,4,6,4,2,6,4,4,4,2,6,6,6,3,6,6,6,6,3,6,6,2,3,6,6,6,6}

    6

    Returns: 29

  53. {3,0,0,3,5,6,3,4,0,0,2,0,3,0,0,4,6,0,0,0,0,4}

    {5,8,6,6,8,8,6,8,5,2,6,8,5,5,5,8,8,8,2,6,5,7}

    8

    Returns: 8

  54. {1,10,4,1,0,1,4,6,4,0,2,0,0,0,7,0,0,6,8,0,2,0}

    {7,11,5,4,2,11,11,11,6,6,11,1,11,11,11,2,9,11,11,11,11,1}

    11

    Returns: 9

  55. {11,12,6,0,0,0,0,4,10,0,0,0,6,5,0,2,4,3,0,4,0,4,7,8,0,0,7,0,6,0,9,0,8,3,0,12,11,4}

    {14,13,9,11,14,8,14,5,14,11,14,14,7,13,14,5,13,10,2,7,10,14,14,12,14,12,14,14,14,13,14,11,14,13,7,13,14,14}

    14

    Returns: 16

  56. {10,0,0,0,5,3,8,0,1,0,0,0,0,1,0,8,0,0,0}

    {12,12,5,12,8,5,12,10,10,12,7,12,7,12,12,12,12,12,12}

    12

    Returns: 12

  57. {3,25,0,0,0,0,0,1,23,0,2,0,0,5,0,28,10,0,0,0,24,0,0,0,4,7,0,0,0,0,0,0,13,18,0,15,20,13,0,5,0,0,0,2,0,0,18,5,32,25}

    {20,33,19,18,25,27,40,12,38,7,35,6,40,36,1,39,19,40,27,30,32,38,3,18,37,40,18,18,15,17,31,40,33,24,40,18,37,28,3,38,40,7,21,21,9,40,33,22,40,34}

    40

    Returns: 9

  58. {23,0,80,1,29,36,81,50,72,59,86,0,30,17,0,1,65,9,5,42,40,9,18,0,0,1,13,30,0,16,23,85,56,97,89,63,0,28,68,18,52,13,0,3,73,0,27,58,12}

    {35,70,99,63,99,63,99,99,99,77,91,46,99,52,6,85,73,34,70,66,42,84,48,98,96,99,78,99,14,99,80,93,93,99,99,72,76,99,79,62,66,93,99,30,99,80,99,99,17}

    99

    Returns: 9

  59. {0,6,0,0,4,0,1,0,0,0,3,9,1,0,7,0,1,3,0,0,4,4,1,1,3,7,9,0,7,7,4,0,1,3,5,0,0}

    {1,8,5,6,7,3,2,5,9,2,8,10,7,2,10,10,9,7,1,1,9,6,8,10,7,10,10,3,8,10,7,4,5,7,6,10,4}

    10

    Returns: 8

  60. {12,0,2,3,0,6,6,2,0,1,6,5,1,1,5,0,12}

    {14,12,11,11,14,7,14,5,14,14,9,14,5,9,9,7,14}

    14

    Returns: 4

  61. {36,0,0,48,39,0,53,41,55,0,0,0}

    {79,9,55,79,79,7,79,75,79,79,79,43}

    79

    Returns: 4

  62. {3,49,11,0,9,22,0,31,53,9,12,28,0,10,56,8,37,3,0,37,0,54,3,28,30,51,0,0,0,53,43,0,20,41,29,11,0,27,10,0,6,2,0,22,0,14,10,64,11,2}

    {45,60,54,67,19,30,17,53,67,27,67,30,40,21,64,42,38,31,4,65,17,67,26,66,42,66,63,45,11,61,67,24,32,58,66,53,32,38,54,67,35,67,6,52,18,35,67,67,25,67}

    67

    Returns: 10

  63. {0,62,35,0,0,0,0,0,33,8,0,0,0,63,0,25,48,0,0,21,6,24,0,0,0,0,38,0,3,5,0,0,8,22,20,0,0,54,37,0,69}

    {19,75,58,74,48,19,3,75,75,47,63,44,5,74,75,75,69,20,24,59,75,41,2,68,74,17,45,38,4,22,75,52,64,62,75,73,10,75,60,27,75}

    75

    Returns: 10

  64. {0,0,0,2}

    {4,2,4,3}

    4

    Returns: 2

  65. {30,0,0}

    {31,52,14}

    52

    Returns: 1

  66. {42,0,24}

    {62,72,31}

    72

    Returns: 1

  67. {100336003,5558556,0,27923388,0,0,23346648,62096350,52690663,7434056,42034958,61199393,12987537,55534374,74781652,14433828,0,56265231,0,19574992,0,87696628,3433151,83352452,60655171,25537540,13960804,3272718,50675278,0,60557293,0,12535536,0,9784132,0,0,0,0,59813119,32509477,0,20215074,17483026,0,81587387,49498696,42770790,49749779,0}

    {104631116,80569929,45082584,30992403,9228908,65257385,27438017,78052293,104631116,75242824,86554079,104631116,18953394,103272894,96152866,103979392,75373592,101547938,88289886,38119764,30547785,104631116,42485635,96892175,104631116,45565352,58492448,64200034,59016544,27984955,66752082,41419793,61083732,37517671,104631116,73456492,79629059,78556958,16068465,100792563,82962114,19742425,97277635,47560909,1576406,104631116,53873627,45817754,104631116,21709294}

    104631116

    Returns: 8

  68. {0,37097328,0,0,68029210,405341380,0,140681400,686031123,25952910,0,0,47477258,232891733}

    {881487895,92871618,769329293,156437505,634418762,815513042,36543620,881487895,827561039,830268829,681658673,185953156,881487895,345602471}

    881487895

    Returns: 3

  69. {3793467,212964,11986295,1937068,2696495,2852335,0,6287926,1629557,1965946,3759312,4174178,0,0,9552759,8049905,4046098,0,5700566,5225872}

    {4063782,4023752,12012954,5417360,6650258,7869427,12107892,12992715,12992715,9552147,10348159,11165466,695575,312888,12992715,12992715,12146414,6852458,9991043,11335634}

    12992715

    Returns: 3

  70. {29065646,152925522,37571882,682171472,46402173,103745454,0,295322891}

    {96443512,850297641,622770615,850297641,436828792,112689188,850297641,850297641}

    850297641

    Returns: 1

  71. {0,0,21104151,395538041,0,537922829,310974354,0,153581425,505420758,694490999,269514910,440283984,493055904,826020584,0,0,0,0,102452170,60307710,0,0,0,509084079,0}

    {831783569,94588988,831783569,831783569,831783569,708667428,590112107,831783569,831783569,583731123,831783569,831783569,831783569,831783569,831783569,831783569,36442077,831783569,831783569,107563381,831783569,291001122,803627864,101395146,781661002,831783569}

    831783569

    Returns: 11

  72. {0,336095354,58157422,0,0,0,224698450,19353909,6556021,309843764,0,110298449,0,65856927,86728963,170093129,288019019,323174239,92781659,41552164,0,0,84628865,116864996,109621165,123881537,178377916,232156828,100908867,269022663,0,176481335,118035837,5040314,105864982,61043129,58638479,3915002,247963590,4257277,102231707,144004156,0,56324630,240835231,0,39842021,0,217259849,300445576}

    {336214244,336214244,198712822,265742187,336214244,323979342,244387785,66433333,149111287,325580700,336214244,336214244,228597723,336214244,293460213,241452572,336214244,336214244,220487888,336214244,224838478,336214244,329567078,274765661,242513296,176698074,336214244,336214244,197418767,336214244,336214244,336214244,138204003,336214244,157412844,336214244,212655895,136310413,336214244,336214244,296047445,212415819,336214244,336214244,336214244,62087634,325900157,336214244,299521500,336214244}

    336214244

    Returns: 12

  73. {291183587,240692463,0,441017875,106872924,3038979,734218811,588924401,425801500,0,506672941,272939426}

    {394746538,663349437,829656840,829656840,306213653,759366841,829656840,754037125,829656840,824391969,573882886,829656840}

    829656840

    Returns: 2

  74. {408311030,61929805,642947904,370695802,558874443,12915770,0,0,607718958,0,66875966,296237647,402028430,0,244311168,252619090,24858913,84368704,84628084,130393851,495655139,132774446,0,0,609724484,533534407,146906659,249867726,606643631,371962305,0,546654852,504210503,356986490,78123584}

    {410416759,631419720,699819336,699819336,676034165,438036724,99523919,649149569,699819336,699819336,318676996,407146342,666268675,669933052,449346982,305176259,246920042,391003569,699819336,534989386,699819336,699819336,570907381,14815967,676831301,699819336,699819336,531274744,609288393,623646708,351029627,652215017,589924272,689035326,550942608}

    699819336

    Returns: 7

  75. {32915998,98501678,35013384,119927293,197142032,101139842,0,0,215733420,99101400,185404916,272742389,29809157,0,59101346,170871520,0,8183428,3037737,0,149030703,28983797,287661099,279658576,81334942,101458954,175227743,0,0,111105161,390382522,20005068,217176499,91921588,230905617,346842408,140014631,0,202521829,0,38065110,0,185273507,89015592,126414707,147626663}

    {360107920,132591396,234287613,240350591,280359475,173392245,419859249,40783339,222854710,211868716,203393283,284285136,285693309,233360288,419859249,366373075,419859249,366962939,376257463,419859249,358491293,124132454,315437430,419859249,210794095,419859249,407885848,13721088,193820305,231477267,419859249,286436800,333336099,95712694,271819776,366079571,229849823,142898707,419859249,265602084,156556104,126061741,246761916,414492733,316024911,314787240}

    419859249

    Returns: 8

  76. {131979916,0,950923174,137177379,125648546,687539289,0,607320819,0,454758101,0,0,141210432,107986815,0,540304460}

    {443094550,744121675,974925433,974925433,288222464,974925433,974925433,708846397,708659223,735533623,974925433,974925433,394688498,447946838,521146504,586303115}

    974925433

    Returns: 5

  77. {0,122093939,73811893,0,826898483,470496887,174880687,0,198532237,0,0,0,890845741,0,862998002,0,244253467,817319903,15547976,167448304,378448520,396720783,0,33597311,138236156,576724416,0,394894994,284907010,774000247,502834848,0,894732916,30003645,0,586717794,0,0,380054731,76783406,454303682,104478235,635309375,233660576,0,783840065,548016933,628707773,0,243612436}

    {1000000000,428503645,134633285,265050051,1000000000,1000000000,1000000000,1000000000,252386442,1000000000,1000000000,1000000000,1000000000,502435629,1000000000,1000000000,1000000000,1000000000,1000000000,1000000000,403595613,488258299,1000000000,1000000000,139287310,1000000000,268729640,1000000000,897732770,1000000000,624786566,1000000000,1000000000,273199926,1000000000,1000000000,757154842,1000000000,411391319,1000000000,1000000000,379421695,1000000000,1000000000,991248178,1000000000,771885615,1000000000,1000000000,1000000000}

    1000000000

    Returns: 16

  78. {900225419,499465710,8492703,0,42025990,838311681,522341612,198418822,0,513823684,360251517,9168107,0,878023676,171947153,506034562,703637046,223455091,734422904}

    {938822927,841497905,713374627,673406283,311365398,1000000000,634660976,698297800,929738083,1000000000,1000000000,478569036,1000000000,1000000000,1000000000,578792107,1000000000,817055708,955713177}

    1000000000

    Returns: 3

  79. {60426907,661398008,242580473,401572977,438197684,0,38961953,0,177959875,249502798,0,618284190,56435206,520764591,0,819347025,74506856}

    {755700049,962560498,283515714,1000000000,701237992,595885888,1000000000,860203194,302806527,743876387,1000000000,952463446,353866923,967400295,292775643,1000000000,684482125}

    1000000000

    Returns: 4

  80. {124443307,0,575889759,0,0,37226136,41381150,570645943,440496024,0,0,96668337,678850370,128671481,302791106,79418224,34357363,0,0,775249608,254420337,0,754415765,0,766405402,423647186,639130052,0,831423813,124160176,2590623,0,659854053,0,288971543,0,105897044,0,661541322,179534301}

    {996152063,738855884,761747496,353861000,49918870,871450338,555300805,678911757,667116666,663319099,588320260,797133529,758355254,411728958,1000000000,1000000000,164188412,70463020,201727536,844013674,416435796,10843526,827612462,883828627,816868652,860318685,1000000000,321867510,988296323,345190046,625486296,644096032,791691826,711609743,852332069,772376723,893989039,1000000000,1000000000,254975340}

    1000000000

    Returns: 5


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: