Statistics

Problem Statement for "PawnGame"

Problem Statement

Alice and Maya play the Pawn Game. The Pawn Game is played on a board that consists of r independent rows. The rows are numbered 0 through r-1. Each row is divided into cells. Different rows may have different lengths: row i consists of C[i] cells. The length of each row is at least three. In each row the cells are numbered from 1 to C[i] from the left to the right.


In each row there is exactly one black pawn and exactly one white pawn. Each pawn occupies a different cell: the black pawn in row i starts in the cell b[i] and the white pawn starts in the cell w[i].


Alice controls the black pawns and Maya controls the white pawns. There are two types of valid moves for the black pawns:

  • A black pawn may be moved one cell to the right if that cell exists and is empty.
  • A black pawn may jump over the white pawn (moving two cells to the right) if the next two cells to the right are a cell with a white pawn followed by an empty cell.
The valid moves for the white pawns are the same, the only difference is that the white pawns move and jump to the left.


The two players take alternating turns to play the Pawn Game. Whenever it's Alice's turn, she has to choose one black pawn and make a valid move with it. Whenever it's Maya's turn, she has to move one of the white pawns. If a player is unable to make a valid move, she loses the game.


Consider two different scenarios. In both of them both Alice and Maya play the game optimally. In the first scenario Alice takes the first turn, while in the second scenario Maya is the first one to play. Return a int[] with two elements: the winner of the game in the first scenario, followed by the winner in the second scenario. (The value 1 means Alice wins, the value 2 means Maya wins.)

Definition

Class:
PawnGame
Method:
WhoWins
Parameters:
int, int[], int[], int[]
Returns:
int[]
Method signature:
int[] WhoWins(int r, int[] C, int[] b, int[] w)
(be sure your method is public)

Constraints

  • r will be between 1 and 50, inclusive.
  • C will contain exactly r elements.
  • Every element of C will be between 3 and 1,000,000, inclusive.
  • b will contain exactly r elements.
  • i-th element of b will be between 1 and C[i], inclusive.
  • w will contain exactly r elements.
  • i-th element of w will be between 1 and C[i], inclusive.
  • For every i between 1 and r, inclusive, b[i] < w[i] will hold.

Examples

  1. 1

    {4}

    {1}

    {2}

    Returns: {1, 1 }

    At the beginning, the only row looks like this: [BW..] where B is the black pawn and W is the white pawn. If Alice starts, her only move is to move B over W, leading to [.WB.]; Maya moves W [W.B.]; Alice then moves [W..B]; Maya cannot move anymore, so Alice wins. If Maya starts, Maya cannot move W because jumping over B would lead it to be out of board. Therefore Alice wins in both cases.

  2. 1

    {5}

    {1}

    {5}

    Returns: {1, 2 }

    The player who starts the game wins in this case.

  3. 1

    {6}

    {2}

    {6}

    Returns: {2, 2 }

  4. 1

    {5}

    {1}

    {4}

    Returns: {2, 1 }

    At the beginning, , the only row looks like this: [B..W.] where B is the black pawn and W is the white pawn. If Alice starts, her only move is to move B [.B.W.]; then Maya's only move is to move W [.BW..]; Alice moves B over W [..WB.]; Maya moves W [.W.B.]; Alice moves [.W..B]; Maya moves [W...B]; and Maya wins. If Maya starts, her only move is to move W [B.W..]; Alice moves B [.BW..]; Maya moves W over B[WB...]; Alice moves [W.B..]; and Alice wins.

  5. 1

    {4}

    {2}

    {4}

    Returns: {2, 2 }

  6. 1

    {849182}

    {118872}

    {655274}

    Returns: {1, 1 }

  7. 1

    {683695}

    {388610}

    {459672}

    Returns: {2, 2 }

  8. 1

    {124637}

    {7456}

    {23803}

    Returns: {1, 1 }

  9. 1

    {178146}

    {126876}

    {129110}

    Returns: {2, 2 }

  10. 1

    {487083}

    {420919}

    {438202}

    Returns: {2, 2 }

  11. 2

    {872677,433569}

    {730810,81189}

    {739430,208510}

    Returns: {2, 2 }

  12. 2

    {468657,699132}

    {132139,345422}

    {300542,565568}

    Returns: {2, 2 }

  13. 2

    {940677,751735}

    {263324,90432}

    {781398,607710}

    Returns: {2, 2 }

  14. 2

    {804795,784084}

    {127793,312821}

    {420495,531488}

    Returns: {1, 1 }

  15. 2

    {375602,357735}

    {43109,206405}

    {359363,256058}

    Returns: {2, 2 }

  16. 7

    {560565,422904,720498,549392,490516,273622,753347}

    {153916,245260,21694,161096,16723,154881,236321}

    {505914,418300,551394,394754,330483,208047,408096}

    Returns: {2, 2 }

  17. 6

    {742772,957444,970514,406015,578974,560627}

    {119387,524486,430541,152780,113687,198281}

    {547877,611130,905356,195889,525445,373214}

    Returns: {2, 2 }

  18. 4

    {196621,241156,115614,37382}

    {13455,23344,23275,3153}

    {39995,54503,82101,36409}

    Returns: {1, 1 }

  19. 6

    {130606,936199,923400,530853,288239,728706}

    {8116,41912,469013,389151,41901,322090}

    {116269,51941,612537,434901,134988,456094}

    Returns: {1, 1 }

  20. 3

    {91782,878620,711929}

    {62327,327522,466260}

    {67484,633396,561494}

    Returns: {2, 2 }

  21. 5

    {915239,458170,396611,335283,202053}

    {494880,286145,180347,74060,108153}

    {902270,286992,316129,293199,201792}

    Returns: {2, 2 }

  22. 5

    {136151,368099,292280,472762,732420}

    {51044,4933,9646,162950,226704}

    {86923,317198,118214,328484,494627}

    Returns: {1, 1 }

  23. 8

    {196000,156121,330681,256995,872001,593719,108297,291933}

    {85963,83402,190703,34219,361992,334484,58616,208151}

    {177403,91907,290583,69390,629950,379641,83020,214927}

    Returns: {2, 2 }

  24. 3

    {925535,41117,738514}

    {135379,4239,264910}

    {185096,11835,428842}

    Returns: {1, 1 }

  25. 9

    {699856,854615,206406,458073,18059,38381,736210,632339,862896}

    {22868,362624,128508,207435,3140,19228,329114,334807,174737}

    {596330,734434,176989,420028,17404,34800,512360,399807,551649}

    Returns: {2, 2 }

  26. 5

    {414542,162018,435822,931712,77240}

    {16906,45880,64425,20235,61469}

    {308029,50170,77171,495599,65992}

    Returns: {1, 1 }

  27. 22

    {966355,417675,2795,36361,449697,777629,358233,579816,417861,610173,295710,641190,30885,644025,783132,54440,479718,380891,371374,88776,726715,880247}

    {682508,165994,2220,2190,307234,373756,42107,161892,152512,263485,5920,8638,911,316349,106218,11850,45189,71790,171867,12878,450593,152236}

    {949400,376474,2290,12227,394329,591591,80652,556069,231525,384464,267508,58767,9060,321896,362200,47037,153633,77066,175645,65363,525695,366542}

    Returns: {1, 1 }

  28. 16

    {234303,672329,178915,973813,146586,889952,628879,487500,179607,163173,977612,835449,50170,838404,475316,579511}

    {129407,494485,57362,106611,40781,604788,473371,46136,74333,31608,38660,242313,3204,646108,55056,248563}

    {153929,573493,163078,710127,78077,608006,476438,391084,88947,103827,912446,363296,40288,829372,258614,304938}

    Returns: {2, 2 }

  29. 23

    {487034,676177,579113,673143,434339,214305,432519,728245,659896,597392,681327,200548,309664,431664,649160,771241,174001,579152,716777,224344,899867,800473,228658}

    {57844,278606,90085,400425,21836,1454,89379,184711,195314,6105,267502,67993,42085,177371,125110,95335,34280,447374,71795,71347,108242,367271,97776}

    {227163,481368,181776,485619,115468,126711,402901,629480,327390,295242,284774,100481,293826,302453,566420,749500,118752,568483,167362,120726,117205,554451,103545}

    Returns: {1, 1 }

  30. 9

    {538730,379544,285573,444419,493413,415779,407575,247883,893630}

    {168657,9121,253989,191733,446201,90488,56561,67455,117484}

    {434756,205656,269254,395306,468615,201107,132012,195109,890078}

    Returns: {2, 2 }

  31. 8

    {490772,192920,983202,821042,560990,869964,38792,79864}

    {147337,70148,331662,596249,310429,86950,2050,47110}

    {284025,160194,412743,761141,482455,708242,36675,51283}

    Returns: {2, 2 }

  32. 20

    {733551,610540,245896,356817,685351,100023,622510,892111,657896,845421,799171,185948,946840,64028,28361,282780,682387,645204,406152,664746}

    {351897,312626,49618,154463,172880,1524,530613,208268,413261,95036,180246,472,384183,53269,3049,40936,179979,255818,5232,49670}

    {351919,543582,148973,257320,497381,59254,586080,594704,567729,478619,557713,124606,866727,59653,9133,70668,217616,445795,358316,438884}

    Returns: {2, 2 }

  33. 23

    {752838,715501,525843,982755,21726,918669,482059,225787,634389,139418,730751,869369,984975,128940,27609,289525,187984,753620,993622,480229,121619,355473,410516}

    {172389,465212,28587,68304,3568,120661,241856,95756,100028,39493,355199,102276,460745,64720,12491,41722,3281,41904,13658,224407,79548,53420,46743}

    {731052,490877,160879,132217,15008,341991,275595,147962,493750,128125,440557,700996,852600,79458,16044,123144,161081,263665,623873,301588,118204,279054,367222}

    Returns: {1, 1 }

  34. 20

    {643322,623526,117816,52843,824567,947108,979490,392222,577724,238316,478227,394422,21563,552469,405338,796098,124057,511519,97878,360387}

    {289537,233143,38922,7778,703067,531999,861131,169923,105743,20014,266538,8277,1843,96770,57800,86261,25381,141222,28822,71380}

    {446196,251771,64250,45400,769418,695832,909999,209361,124880,225530,393604,182454,17186,398221,184879,528330,73370,238541,34094,148128}

    Returns: {2, 2 }

  35. 23

    {516402,518222,458089,567037,910882,489565,999273,5063,595472,892809,255096,483015,444804,850299,400135,216938,904091,351810,35711,656897,751952,777179,591914}

    {40345,42193,65218,111908,715764,195551,286519,4523,69619,297521,96949,329752,287052,548910,220462,92816,560415,90906,28119,121677,167044,338496,198456}

    {444820,249815,266837,321482,744920,411644,837806,4722,322669,512683,225428,412575,306865,769425,371031,93739,681415,255720,35323,552979,604527,369462,341130}

    Returns: {2, 2 }

  36. 23

    {666576,880746,757068,387895,250913,185404,487584,896038,629919,679187,669966,625811,761350,823071,192357,92955,598709,269690,534712,366243,595924,342078,485515}

    {497319,38216,311853,75591,228255,159013,100041,199594,131706,13031,75929,121712,4723,111281,76227,17788,132621,132404,277528,171108,389595,2004,305015}

    {596032,333889,511570,291706,234346,163307,169387,601419,562373,661191,630522,544327,213599,685109,184465,39430,169235,187658,408713,250362,531363,336400,320167}

    Returns: {2, 2 }

  37. 18

    {352779,985868,89539,188840,694793,604007,951959,744790,67733,987443,244162,547559,470925,728711,618867,582752,771425,268800}

    {76848,386983,69624,17451,349610,240075,2247,143090,18915,626427,207825,61280,4087,170156,218572,52761,331811,47634}

    {188150,912598,78051,39333,486333,430220,171351,210544,23219,909815,216469,340205,39443,495082,344852,450358,459137,90164}

    Returns: {1, 1 }

  38. 24

    {669394,2962,149587,424301,82622,419520,5659,221462,871039,450535,319609,848353,344174,723666,864275,552323,696713,783933,682485,471364,475400,146262,476814,110829}

    {36332,393,13717,122923,78080,67754,306,118410,474311,212055,76000,684644,37226,162619,48769,78039,314924,1614,113316,342347,226455,41134,295149,44158}

    {223686,1900,16137,264618,80376,156331,5484,139774,801358,331834,249993,829890,114697,601510,629203,335690,398784,581799,150076,446857,260939,119107,449808,47590}

    Returns: {2, 2 }

  39. 11

    {73819,645735,780510,516139,151637,74653,949729,557414,545167,210619,363188}

    {29801,283499,130925,64064,101122,70654,203739,113807,274744,11326,175062}

    {73241,544191,253772,322035,149323,74226,685854,159162,520539,84989,269803}

    Returns: {1, 1 }

  40. 14

    {228277,599621,34001,24173,107121,501897,772836,769335,190223,724512,593760,102717,464679,533282}

    {9896,222357,19603,18181,11475,229218,126738,78791,14618,375462,58018,2178,4198,7914}

    {32633,591620,27776,24052,61926,323381,750335,557143,125114,695022,426054,96098,144424,312295}

    Returns: {1, 1 }

  41. 6

    {697472,80238,65531,241401,619164,164913}

    {50597,34745,25215,53913,276554,38697}

    {389158,76058,64545,133021,570819,65325}

    Returns: {1, 1 }

  42. 6

    {927376,617714,245998,734880,44566,47483}

    {440649,49818,99542,104027,38136,3517}

    {449190,332909,214428,326626,39066,14241}

    Returns: {1, 1 }

  43. 21

    {992850,884648,738539,170561,589538,136854,483226,579665,55596,809413,134929,475198,627490,42983,999388,133912,298922,607808,799441,609992,741284}

    {35736,116520,370420,70247,170070,52416,72679,78366,5679,157393,27765,87574,525473,22537,494154,31348,49976,37166,257113,249732,45180}

    {411661,403732,461490,122600,525508,82302,120432,437251,48859,160748,48146,378934,553445,29013,597860,110872,240316,238392,641826,418468,255218}

    Returns: {1, 1 }

  44. 5

    {184618,456080,314018,730410,319394}

    {126678,1093,187192,168966,52300}

    {158310,101247,256670,295269,240685}

    Returns: {1, 1 }

  45. 11

    {453942,405693,736836,979588,551028,621171,511432,571655,1197,873854,621945}

    {346245,141608,444189,196688,116956,13346,256567,376585,669,337160,49401}

    {361140,214349,605246,250558,138795,174894,493371,417852,682,651870,525929}

    Returns: {1, 1 }

  46. 16

    {691006,880935,51604,895368,696705,214285,688380,37621,293832,708770,823617,847959,554112,94387,373141,765223}

    {95178,150882,15508,143806,283480,32367,229610,9163,175212,215040,754226,533784,7354,29478,99167,396807}

    {343269,851169,28508,267800,648182,164812,328394,35934,207686,606803,773680,738684,423318,83622,109280,465513}

    Returns: {2, 2 }

  47. 48

    {931214,161506,303777,932484,18149,956962,673523,24158,811854,722119,707839,944585,298631,698243,32622,911849,367385,482229,680101,911559,872033,294808,819014,353294,196886,48422,960735,650807,183404,353547,882837,166288,564167,481978,229260,357203,565707,105585,447233,40840,756769,946258,924535,544869,920736,638771,840470,13311}

    {125541,34882,243998,87734,334,176871,44433,1504,447638,16189,99966,69331,7776,385562,1052,445322,32218,78079,556619,437736,542884,239474,364959,117513,74268,30554,13146,194731,42368,10025,144128,67346,327365,30875,20137,71513,270485,57623,52823,18382,356306,344175,224536,177450,593111,67325,85195,6276}

    {591481,60162,273811,470845,15707,693997,201329,14836,681605,717579,513981,708985,204880,391605,30911,738745,216808,191097,613471,813453,815193,262965,499684,351235,179911,42952,612101,377342,149428,24701,668700,117846,341419,276760,210469,203149,371586,67484,406305,33592,362781,458459,749221,510647,902956,446445,464855,11471}

    Returns: {2, 2 }

  48. 33

    {818579,846889,918962,57279,530855,801467,158202,244307,267804,791875,246356,808941,391267,484332,630443,703215,229142,132266,173095,247006,150533,87676,969569,366442,203324,513467,397616,2905,225038,433977,898275,940288,244310}

    {168775,304046,253338,4302,226698,753033,13739,40460,51849,538116,35825,83649,116500,121099,18254,126183,5937,47164,30328,69255,87695,56758,247079,171343,31130,304650,25585,979,186247,2821,438252,4293,174533}

    {403120,436834,668455,18356,512018,772332,80194,138314,138404,646308,106088,761816,189052,452446,345329,394153,135532,129645,101559,111876,139353,83644,782306,231626,68235,452862,274097,2234,202753,17677,837495,492887,176946}

    Returns: {2, 2 }

  49. 28

    {134082,888933,181097,838245,934319,231142,403245,312554,2553,812235,810712,108877,635438,804734,158259,416758,567392,241701,525071,488294,126538,716177,326633,150528,554881,53428,163515,694079}

    {58023,153042,22366,713436,369881,87669,6163,149812,696,51176,56797,10391,46862,130252,86984,50074,81393,82071,314081,239023,60691,322453,92878,69378,363987,16620,1227,445632}

    {113629,633611,153806,752366,787666,227336,360719,240491,1301,696996,249862,80568,250503,568186,99396,293666,556851,175906,324682,458478,75109,432407,139149,145017,372954,37975,8892,543075}

    Returns: {2, 2 }

  50. 47

    {660500,849942,58801,152348,441729,967705,678000,896514,768900,291483,346652,80137,908442,721047,8699,922397,489719,870690,953779,537877,183705,128220,480612,391006,595431,863031,552775,934878,352027,450614,304658,365274,249768,900467,147307,207300,89859,618637,41951,110018,770610,956526,44187,512759,833871,373673,710955}

    {578244,73069,2069,119760,126738,275038,47906,245029,139821,184436,139367,56916,252373,255236,5865,36405,62685,29145,670145,166134,69717,65784,10393,192704,308043,320101,130391,196933,9384,106371,4076,56234,184811,65525,59078,31820,23414,26983,12554,55886,488503,241431,22758,100901,389936,53895,140057}

    {599212,382716,28697,124625,206627,964783,455029,347865,698901,212900,298480,77034,807750,636758,8097,840619,383614,680279,831232,375136,157165,72285,169032,206502,364361,520303,532948,781197,227011,362500,13949,161733,206935,511497,139697,81023,28256,611745,14122,82008,641236,295237,28634,335723,516609,78505,576272}

    Returns: {1, 1 }

  51. 40

    {360232,950645,200330,425742,852449,569373,872411,108885,701471,229480,573372,248770,931931,859669,183600,981790,671320,986589,565070,337840,639834,719032,91117,87560,496523,644258,978455,83953,948772,246494,528951,327237,717705,715206,622540,325264,307934,206544,282611,507562}

    {109269,494673,101651,6800,192837,169786,730959,101843,247222,124580,153900,177237,505757,58108,6724,563294,102133,67553,468891,83723,227237,574392,34513,39755,7586,41385,143125,51422,83534,171236,93920,169990,479115,188446,267230,127144,186848,1498,115661,156990}

    {146433,817002,199781,320604,338991,402156,819385,104793,440678,162184,417088,231399,848936,90634,44446,763745,593549,78672,528862,239814,513411,591323,82977,48841,318759,599282,610867,51898,101229,199478,95674,263417,616375,568281,538380,283219,219725,14680,246562,394262}

    Returns: {2, 2 }

  52. 47

    {995248,49094,428932,699395,35747,375387,674886,447045,205422,839624,145233,311288,49978,598397,924792,205154,734286,363003,635536,166140,934915,15612,440301,364334,117015,964287,582596,538735,54512,126473,495674,382389,805987,758992,33211,93017,977321,497946,984205,964025,10345,106545,122735,763800,99323,214527,83191}

    {449813,13627,85743,117933,3807,196659,124063,135245,89652,574609,80015,156866,19886,130155,456641,13643,249115,126400,301529,7110,58277,1645,268208,237316,10295,210766,91399,23469,3619,7957,459180,120396,179587,313779,2173,83845,8488,158974,194138,218218,1570,44830,3722,432037,49488,79238,57777}

    {824078,36199,331236,433434,19214,294504,441258,310135,172606,671296,144278,289707,31168,399065,811626,108469,388265,335660,591394,79667,279220,10616,419811,334358,83059,833705,482759,184632,26569,102805,472945,269776,297896,686329,13994,84913,468681,446674,359204,963963,2827,64798,107646,725559,91020,148007,71069}

    Returns: {2, 2 }

  53. 24

    {571210,523513,674013,765246,532540,50429,599685,33634,905224,855466,423794,387116,220400,32661,252848,637541,641342,194329,521424,993766,148760,738888,525813,318490}

    {383739,111813,182128,11684,261365,30810,296194,6643,124506,271357,73795,58744,199865,6346,80991,284833,130490,896,13578,232511,16316,25573,158139,124069}

    {525905,343289,490388,140585,297298,33211,392166,27866,778631,563631,156170,298187,210193,14171,190047,398681,580249,69420,230316,460260,139403,479307,379235,252117}

    Returns: {1, 1 }

  54. 19

    {776410,213966,847729,553434,34820,747200,233375,74182,48474,508071,430836,71495,489224,142077,833495,333071,47010,575934,549616}

    {280676,78141,593645,25002,2678,253291,30611,42957,28515,147238,125809,40777,236413,472,591289,146112,9418,5029,149289}

    {489222,187985,753838,98282,4522,334822,138507,59859,44378,154544,365407,63387,344611,109080,718848,306077,12969,276394,491743}

    Returns: {2, 2 }

  55. 13

    {128633,937781,21233,846189,845563,5779,731748,338265,847833,532959,901304,207051,568432}

    {93878,405167,7741,121812,1139,2143,521304,38505,209353,107027,495169,28147,4782}

    {96953,517242,11423,756382,379978,3010,553312,311235,420891,354626,506286,73256,419461}

    Returns: {1, 1 }

  56. 11

    {642442,915803,137740,603575,176285,659565,44851,424916,581885,261690,444424}

    {69805,153286,13827,140424,75286,386752,3571,87413,128491,115293,253677}

    {328107,801998,49017,524030,87589,396779,35568,89473,220689,140758,397703}

    Returns: {1, 1 }

  57. 37

    {931420,37409,420805,929483,675937,236686,753193,318707,118647,143812,538559,603459,551656,29591,649333,609746,283379,720155,600150,247116,680669,402283,816851,296260,337055,143636,207385,132532,956647,509156,26430,627252,294139,527110,828459,608807,515801}

    {257881,17884,355221,74162,621670,139192,95639,11655,11383,5927,121907,70863,280733,6701,50973,182454,106676,62239,536870,76319,481137,166106,145037,20021,82759,14920,32704,66829,423916,101848,11687,535044,105577,180800,561002,410382,258322}

    {323661,36390,364561,878053,670359,193505,222674,159394,50193,25112,243898,108975,450589,27632,614908,504203,244923,641847,582657,83204,536608,240820,565926,114157,223751,138051,90288,69251,762352,427581,25187,559911,258707,217540,748683,416225,370349}

    Returns: {2, 2 }

  58. 41

    {605177,802330,24207,944756,622869,844166,264953,295747,516356,257299,147933,146734,566544,137811,541390,341691,496189,69995,729609,392134,975768,585909,236691,158517,689508,670889,314342,731995,113608,282478,909348,29269,105464,562005,157094,500028,318886,270505,837891,650604,260943}

    {245843,161353,9654,570882,251951,490270,214700,128347,23722,2869,5333,73662,222598,26896,244197,77451,362477,46537,524102,241443,179136,120306,52177,58281,269847,427495,33990,92792,1417,222357,85041,10506,35067,147537,31012,133675,28416,109666,261277,82451,33593}

    {552407,786920,13373,778219,283541,683793,220635,239169,158233,214616,25478,127595,444821,69613,473677,298901,414777,60857,678552,343567,786389,417935,233854,108862,546027,556883,219521,234850,12730,245282,195519,14674,87993,220745,32167,243202,268358,114119,726097,620949,159786}

    Returns: {2, 2 }

  59. 11

    {50844,683376,640343,324655,122845,437315,518430,677653,718073,435700,4904}

    {9185,368944,158589,45137,20644,169289,266452,125749,540543,166372,1672}

    {50136,473509,534379,64041,40052,252443,313422,167251,599188,307606,2620}

    Returns: {2, 2 }

  60. 34

    {485993,978998,14605,414097,506053,87837,140593,445604,218509,167890,46964,859876,418605,719090,554771,230797,848854,255211,559988,477705,817913,978517,100704,186373,757872,770643,140655,730903,256436,999496,771154,542904,815070,323527}

    {217383,120650,3170,45323,144246,82667,58344,210258,171542,28344,20805,124356,26071,126674,219392,130223,243320,54729,160982,286632,208721,443567,16165,5084,256136,481348,8627,83426,152401,240667,88709,313556,74633,38882}

    {323494,304041,11364,164923,194971,82714,60364,402983,191249,79165,34902,661225,413127,594735,250394,173532,610887,154175,468138,290774,508528,831061,71743,32420,384744,622914,65479,122870,192312,681563,123940,429317,430679,122885}

    Returns: {1, 1 }

  61. 23

    {659250,928111,280069,61778,820227,313890,741533,522780,331713,296942,987262,761983,548289,410577,398648,628168,698880,358248,556595,372923,331382,314018,377067}

    {116970,344955,4954,13924,286106,247162,199873,74184,197269,68640,315305,133460,25949,8570,199307,133344,229483,111178,263846,68841,35719,127837,84274}

    {195694,880126,254945,30116,503182,279891,658198,104975,202853,75964,384700,652317,287897,43007,348437,254527,428445,335623,310760,198702,288819,147087,85610}

    Returns: {1, 1 }

  62. 28

    {196858,853088,688337,899490,497215,944083,925304,982229,286940,568889,929841,65067,870964,700543,55155,597439,266147,570432,803649,697607,166399,953545,909394,925088,235164,100235,893676,598949}

    {57936,272850,333945,9491,141112,265383,491850,486001,12633,310059,85818,32990,728969,10608,6543,2256,154291,194720,28030,475287,135381,266617,489928,448703,10844,3545,704715,43812}

    {102963,458895,355070,174601,477078,643359,840197,595836,198088,424875,626739,64834,856488,674363,38314,66907,159270,344324,150807,564245,158934,542972,600549,874866,37127,22446,843048,498260}

    Returns: {2, 2 }

  63. 19

    {320491,389616,20349,903636,508148,973332,100855,780420,414777,816423,186274,462728,309356,855716,666874,29795,272088,182329,827725}

    {53166,239374,14770,380359,211932,594622,27114,24480,51274,423208,66185,399349,144310,226461,156233,15754,31629,40519,233022}

    {239676,251185,15779,528383,492407,965851,71543,675670,113085,665739,137466,400864,195377,787698,247802,27994,43565,51372,308427}

    Returns: {2, 2 }

  64. 21

    {999675,12106,587310,334301,949672,539970,854034,744682,119590,640593,653508,972657,743477,919180,934623,997213,374611,594040,495514,581407,951504}

    {94374,7932,52348,10393,510840,277639,56417,7637,34428,70210,186684,427964,170047,291020,96089,293695,117642,52853,57595,116020,303401}

    {246181,10857,411728,90268,871598,348959,338008,19504,85811,291939,611693,513383,485517,592545,370520,430233,180122,65301,140837,200519,618273}

    Returns: {1, 1 }

  65. 36

    {138234,305607,995674,876803,257829,289394,251031,199694,257478,243901,943415,420373,365640,738194,916483,802014,962005,488193,770854,382210,161592,331889,384573,596990,905246,274995,989817,831820,985870,965133,510874,952767,477022,681099,599819,216888}

    {78205,6280,101793,17801,171884,161214,26256,48708,171239,170693,277747,167249,47122,58097,554310,153848,376183,156074,35601,57012,69361,125362,54174,441275,671863,146128,294753,252703,607821,222819,242787,33938,219862,255858,260921,87737}

    {128085,206689,783595,121756,223817,267872,94935,104047,252695,174542,808989,341421,132857,442098,850302,276680,695373,278652,268651,160220,129054,302204,136299,488123,845130,250433,604993,350196,661317,377311,331372,917564,257607,561018,420106,179945}

    Returns: {1, 1 }

  66. 1

    {5 }

    {1 }

    {4 }

    Returns: {2, 1 }

  67. 5

    {3, 3, 3, 3, 10 }

    {1, 1, 1, 1, 4 }

    {2, 2, 2, 2, 8 }

    Returns: {2, 2 }

  68. 2

    {6, 4 }

    {3, 2 }

    {4, 4 }

    Returns: {2, 2 }

  69. 2

    {6, 3 }

    {2, 2 }

    {3, 3 }

    Returns: {1, 1 }


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: