Statistics

Problem Statement for "WarehouseJob"

Problem Statement

Recently you got a job and have been working in a warehouse. One of your tasks is to arrange a number of boxes one on top of another in a single pile, so that they take up less space on the floor. The boxes have different weights, as each of them holds different goods inside. Because some goods need to be accessed more often than others, certain boxes must lie above certain other boxes. Because you are very lazy, you decided to write a program that will calculate an arrangement that requires the least effort from your side.

Placing the bottom most box doesn't cost any effort. Placing each of the other boxes requires w * h effort, where w is the weight of the box, and h is the number of the boxes arranged so far. You can assume that all boxes are cubes with the same dimensions.

You are given a int[] weight, which represents the weights of the various boxes. You are also given a String[] above, where above[i][j] is '1' if the i-th box must lie above the j-th box, and '0' if there is no such constraint. Return a int[] containing the ordering of the boxes that requires the least total effort. Each element of the int[] is the 0-based index of a box, and the elements must be ordered from bottom to top. If there are multiple such orderings, return the one where the bottom box has the lowest index. If a tie still remains, return the one where the second box from the bottom has the lowest index, etc.

Definition

Class:
WarehouseJob
Method:
stackBoxes
Parameters:
int[], String[]
Returns:
int[]
Method signature:
int[] stackBoxes(int[] weight, String[] above)
(be sure your method is public)

Constraints

  • weight will contain between 2 and 16 elements, inclusive.
  • Each element of weight will be between 1 and 1000, inclusive.
  • weight and above will contain the same number of elements.
  • Each element of above will contain exactly n characters, where n is the number of elements in weight.
  • above will contain only the digits '0' and '1'.
  • There will always be at least one possible ordering.

Examples

  1. {1,2,3}

    {"000","000","000"}

    Returns: {2, 1, 0 }

    We have boxes of weights 1, 2 and 3 and no contraints about their order. Therefore it's best to put the heaviest box on the ground, the second heaviest on top of it, and the lightest on the top.

  2. {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}

    {"000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000","000000000000000"}

    Returns: {14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }

  3. {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }

  4. {10,1,1000}

    {"000","000","010"}

    Returns: {1, 2, 0 }

    The last box must lie above the second box.

  5. {4,3,3}

    {"000","001","000"}

    Returns: {0, 2, 1 }

  6. {10,1}

    {"00","10"}

    Returns: {0, 1 }

  7. {997,357,681,975,776,74,925,820,228,154,572,962,721,693,190,285}

    {"0101010110000011","0010000010010001","0001111011011001","0000011111001101","0000000010011001","0000000001001111","0000000000010001","0000000010101000","0000000000111101","0000000000000100","0000000000000100","0000000000000110","0000000000000001","0000000000000010","0000000000000001","0000000000000000"}

    Returns: {15, 12, 14, 13, 11, 6, 10, 8, 7, 4, 9, 5, 3, 2, 1, 0 }

  8. {69,960,221,183,829,987,555,213,632,906,655,603,176,289,670,955}

    {"0011001000101101","0010111010011000","0000101110001100","0000000001100010","0000000101001000","0000001100000010","0000000001010001","0000000011000010","0000000001001001","0000000000111001","0000000000001000","0000000000001101","0000000000000010","0000000000000000","0000000000000001","0000000000000000"}

    Returns: {15, 14, 12, 10, 13, 11, 9, 8, 6, 7, 5, 4, 2, 1, 3, 0 }

  9. {1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000}

    {"0000100000000000","0000000100000000","0000000001000000","0010000000000000","0000010000000000","0000000000000100","0001000000000000","0000000000001000","0000000000000010","0000000000100000","0000000000010000","1000000000000000","0000000010000000","0100000000000000","0000000000000001","0000000000000000"}

    Returns: {15, 14, 8, 12, 7, 1, 13, 5, 4, 0, 11, 10, 9, 2, 3, 6 }

  10. {493,983,147,93,114,974,193,839,622,280,86,591,694,372,676,856}

    {"0101110001110011","0011010110010010","0001011010110101","0000001010110000","0000000000010000","0000001101111001","0000000011001110","0000000010011100","0000000001111110","0000000000011010","0000000000001011","0000000000001001","0000000000000111","0000000000000001","0000000000000001","0000000000000000"}

    Returns: {15, 14, 13, 12, 11, 9, 10, 8, 7, 6, 5, 3, 2, 1, 4, 0 }

  11. {358,611,611,982,651,1,189,98,623,492,916,394,890,923,361,812}

    {"0110110100010110","0000000000000001","0100000100000011","0010010101000010","0010000001000000","0000000100000000","0100110000010001","0000000000000000","0111010100010010","0000010100000001","1000110100000001","0111000101000000","1111100010010001","0010110010010001","0000010101000000","0000000000000000"}

    Returns: {15, 1, 7, 5, 9, 14, 2, 3, 4, 11, 8, 13, 0, 10, 12, 6 }

  12. {183,514,532,117,48,676,584,1,952,233,926,889,612,432,381,675}

    {"0100000000001000","0000000000000000","1101000011000011","1000000101101010","1001001110111100","0101000111101010","1111010111101011","1100000000000010","1101000001101010","0100000000001000","1000000101001010","1111010101101001","0000000000000000","1111011111111011","1000000000001000","1000000101001010"}

    Returns: {12, 1, 0, 14, 9, 7, 10, 15, 3, 8, 5, 2, 11, 6, 13, 4 }

  13. {240,885,688,131,725,992,539,174,456,495,362,985,909,653,658,870}

    {"0000000000000000","0000001001000100","0000011000000000","0000001000000000","0001000000000000","0100000000000000","0000000000000000","0001000001110001","0000010000000101","0000000000000100","0000000000000000","0000000000000000","0000000000000100","0000001000000000","0000100001001100","0100000001000000"}

    Returns: {11, 6, 13, 12, 9, 1, 5, 15, 2, 3, 4, 14, 8, 10, 0, 7 }

  14. {891,67,455,663,626,563,110,374,325,227,463,71,603,738,401,688}

    {"0000000000000000", "0000000000000000", "0000000000000000", "0000000000100000", "0000000000000010", "0000001000000000", "0000000000000000", "0000000000000000", "0000000000000000", "0000000100000000", "0000000000000000", "0100000000000000", "0100000010000000", "0000000110000000", "0000001000100000", "0000001000100000"}

    Returns: {0, 10, 3, 7, 8, 13, 6, 15, 5, 14, 4, 2, 1, 12, 9, 11 }

  15. {829,480,806,812,147,159,253,773,255,745,641,509,179,149,562,309}

    {"0000000000000000","0000000000000000","0000000000000010","0000000000000000","0000000000000010","0000000000000000","0001000100000000","0000000000000000","0010000000000000","0100000000000000","0000000000000000","0000000000000010","0000000000000000","0000000000000010","0000000100000000","0000000000000000"}

    Returns: {0, 3, 7, 14, 2, 10, 1, 9, 11, 15, 8, 6, 12, 5, 13, 4 }

  16. {221,624,360,850,577,419,260,98,878,223,276,71,490,844,836,917}

    {"0000000000000000","0000000000011000","0001000001000000","0000000000000000","0000000000000000","1001100000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000010","0000000000000000","0000000000000000","0000000000000010","0000000000000010","0000000000000000","0000001000010000"}

    Returns: {8, 3, 14, 13, 4, 12, 6, 11, 15, 1, 0, 5, 9, 2, 10, 7 }

  17. {588,190,317,218,71,580,961,940,530,391,595,947,794,374,992,793}

    {"0000000000010000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000100000000000","0000000000000000","0000000000000000","0000000000010000"}

    Returns: {14, 6, 11, 7, 15, 10, 0, 5, 8, 4, 12, 9, 13, 2, 3, 1 }

  18. {2,2,2,1,1,1,1,2,2,1,1,1,2,1,2,2}

    {"0000000000000000","1000000000000000","0100000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000010000","0000000000000000","0000001000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000010000000000","1000000000000000","0000100000000000"}

    Returns: {0, 1, 2, 7, 12, 14, 4, 15, 11, 6, 8, 3, 5, 9, 10, 13 }

  19. {1,1,1,2,1,1,2,1,2,1,2,2,1,2,1,2}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0100001000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000100000","0000000000000000"}

    Returns: {3, 6, 8, 10, 11, 13, 15, 0, 1, 2, 4, 5, 7, 9, 12, 14 }

  20. {1,9,2,3,1,4,6,2,2,8}

    {"0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000"}

    Returns: {1, 9, 6, 5, 3, 2, 7, 8, 0, 4 }

  21. {3,7,5,20,6,4,14,12,1,4}

    {"0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","0000000000","0100000000","0010000000","0000000000"}

    Returns: {3, 6, 1, 7, 4, 2, 5, 9, 0, 8 }

  22. {3,9,8,5,8,9,7,3,9,5,4,10}

    {"000000000000","000000000000","000000000000","000000000010","000100000000","000000000100","000000001000","000000000000","000000000000","000000000000","000000000000","000000000000"}

    Returns: {11, 1, 8, 2, 6, 9, 5, 10, 3, 4, 0, 7 }

  23. {11,10,10,19,18,3,20,3,6,6,18,8}

    {"000000000000","000000000001","000000001000","000000000000","000000000000","000000000000","000000000000","000000000000","000000000000","000000000000","000000010000","000000000000"}

    Returns: {6, 3, 4, 0, 7, 10, 11, 1, 8, 2, 9, 5 }

  24. {208,427,273,964,868,114,559,183,571,629,359,346,254,568,786,927}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000010000","0000000000000000","0000000000000000","0000000000000001","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000001000000","0000000000000000","0000000000000000","0100000000000000"}

    Returns: {4, 14, 1, 15, 11, 3, 9, 8, 13, 6, 10, 2, 12, 0, 7, 5 }

  25. {933,663,486,931,337,381,214,519,759,658,875,468,372,532,741,402}

    {"0000000000000000","0000000000100001","0000000000000000","0000000000000000","1000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {0, 3, 10, 8, 14, 9, 15, 1, 13, 7, 2, 11, 5, 12, 4, 6 }

  26. {518,742,265,763,106,664,493,362,29,882,541,377,674,252,964,802}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000010","0000000000000000","0000000000100000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000010000","0000000000000000","0000000000000000"}

    Returns: {14, 9, 15, 3, 1, 12, 5, 10, 0, 6, 11, 7, 2, 13, 4, 8 }

  27. {517,43,355,350,467,808,87,276,73,959,526,594,973,369,751,170}

    {"0000000100000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0100000000000010","0000000100000000","0000000000000000","0100000000000000","0000000000000000","0000000000000001","0000010000000000","0010000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {9, 14, 2, 12, 1, 5, 11, 4, 7, 0, 13, 3, 15, 10, 6, 8 }

  28. {439,289,986,780,45,738,826,548,454,830,312,837,269,736,206,381}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1000000000000000","0000000000000000","0000000000000000","0000000000000000","0100000000000000","0000000000000000","0000000000000000","0001000000001000"}

    Returns: {2, 11, 9, 6, 3, 5, 13, 7, 0, 8, 1, 12, 15, 10, 14, 4 }

  29. {878,666,840,361,658,515,284,423,512,923,456,835,543,715,538,12}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {9, 0, 2, 11, 13, 1, 4, 12, 14, 5, 8, 10, 7, 3, 6, 15 }

  30. {262,381,309,540,494,172,130,497,451,486,851,488,899,346,382,2}

    {"0000000000000000","0000000000000000","0000000000000000","0000010000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000010","0000000000000000","0000000000000000"}

    Returns: {12, 10, 7, 4, 11, 8, 14, 1, 0, 9, 5, 3, 13, 2, 6, 15 }

  31. {321,109,44,359,927,703,105,335,373,33,214,318,119,698,602,62}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1000000000001000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {4, 13, 14, 0, 12, 5, 8, 3, 7, 11, 10, 1, 6, 15, 2, 9 }

  32. {402,417,668,416,196,279,786,844,913,176,337,309,517,146,155,620}

    {"0000000000000000","0000000000000000","0100000000000000","0000010000000000","0000001000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000001000","1000000000000000","0000000000000000","0000000000000000","1010000000000000"}

    Returns: {8, 7, 6, 1, 2, 0, 15, 12, 5, 3, 10, 11, 4, 9, 14, 13 }

  33. {796,80,938,309,370,608,473,640,669,742,150,143,856,886,332,574}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000001000001000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1000000000000000","0000000000000000","0000000001000000","0000000000000000","0000001000000000","0010000000010000"}

    Returns: {2, 13, 9, 12, 0, 8, 7, 5, 6, 4, 11, 15, 14, 3, 10, 1 }

  34. {403,756,272,918,723,507,645,493,926,73,481,767,810,472,939,518}

    {"0000000000010000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000001000000000","0000000000000000","0000000000000000"}

    Returns: {14, 8, 3, 12, 11, 1, 4, 6, 15, 5, 7, 10, 13, 0, 2, 9 }

  35. {487,398,128,47,682,847,334,44,689,817,534,819,614,376,582,427}

    {"0000000000000000","0000000000000000","1000001000000000","0000000000000000","0000000001000000","1000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1000000000000000"}

    Returns: {11, 9, 8, 4, 0, 5, 12, 14, 10, 15, 1, 13, 6, 2, 3, 7 }

  36. {908,80,23,266,907,534,213,398,468,450,730,771,662,933,630,620}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000100000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {13, 0, 4, 11, 10, 12, 14, 15, 5, 8, 9, 7, 3, 6, 1, 2 }

  37. {555,864,194,1,27,581,353,729,583,101,528,644,939,868,252,916}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {12, 15, 13, 1, 7, 11, 8, 5, 0, 10, 6, 14, 2, 9, 4, 3 }

  38. {21,122,640,96,629,605,545,453,440,477,588,332,387,812,661,240}

    {"0000000000000000","0000000000000000","0000000000100000","0000000000000000","0000000000001001","0010000000000000","0000000000000000","0000001000000000","0000000000000000","0000001000000000","0000000000000000","1000001000000000","0000000000000000","0010000000000000","0000000000000000","0000000000000000"}

    Returns: {10, 2, 13, 14, 5, 6, 9, 7, 8, 12, 15, 4, 0, 11, 1, 3 }

  39. {205,458,992,441,318,954,401,46,865,120,981,558,124,451,326,168}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0100000100000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {2, 10, 5, 8, 11, 1, 13, 3, 6, 14, 0, 7, 4, 15, 12, 9 }

  40. {124,328,685,545,774,741,776,63,787,911,519,220,752,12,421,109}

    {"0000000000000000","0000000000000000","0000000001000000","0000000000000000","0000000000000000","0000000000010000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000100000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {9, 8, 6, 4, 2, 10, 12, 3, 11, 5, 14, 1, 0, 15, 7, 13 }

  41. {752,148,986,448,762,685,790,657,168,951,898,941,958,245,84,477}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000001","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000100000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000010000000000"}

    Returns: {2, 12, 11, 10, 4, 9, 6, 0, 5, 7, 15, 3, 13, 8, 1, 14 }

  42. {795,333,210,113,481,958,466,577,32,387,932,982,421,257,252,164}

    {"0100000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000001000000000","0000000000000000","0010000000000000","0000000000000000","0000000000000000"}

    Returns: {5, 10, 6, 11, 7, 1, 0, 4, 12, 9, 14, 2, 13, 15, 3, 8 }

  43. {698,67,381,936,490,25,80,352,899,447,478,327,643,939,632,204}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000001000","0000000000000000"}

    Returns: {13, 3, 8, 0, 12, 14, 4, 10, 9, 2, 7, 11, 15, 6, 1, 5 }

  44. {539,990,195,994,223,216,437,552,650,826,124,937,567,677,536,488}

    {"0000000000000000","0001000000001000","0000000000000000","0000000000000000","0100000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000100"}

    Returns: {3, 11, 9, 12, 1, 13, 8, 7, 0, 14, 15, 6, 4, 5, 2, 10 }

  45. {345,433,971,99,580,21,600,664,633,625,115,175,431,3,247,909}

    {"0000000000000000","0000001000000000","0000000000000000","0000000000000000","0000000000000000","0000000000010000","0000000000000000","0000000000000000","0000000000000000","0000000000100000","0000000000010000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0001000000000000"}

    Returns: {2, 7, 8, 6, 4, 3, 15, 1, 12, 0, 11, 10, 9, 14, 5, 13 }

  46. {805,782,428,733,907,328,140,499,788,973,646,821,509,445,273,955}

    {"0000000000000000","0000000000000000","0000000000000000","0000010000000000","0000000000000000","0000000001000000","0000010000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000001000000","0000000000000000","0000000000100000","0000000000000000","0000000000000000"}

    Returns: {9, 15, 4, 11, 0, 8, 1, 10, 5, 3, 12, 7, 13, 2, 14, 6 }

  47. {688,273,70,502,891,90,154,723,787,453,518,429,433,978,914,121}

    {"0000000000000000","0000000000000000","0000000000000000","0000100000000000","0000000000000000","1000000000000000","0000000000000000","0000000000000000","0000000000000000","0100001000000000","0000000000000000","1000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {13, 14, 4, 8, 7, 0, 10, 3, 12, 11, 1, 6, 9, 15, 5, 2 }

  48. {242,103,876,756,587,224,717,906,841,98,672,711,338,724,519,114}

    {"0000000000000000","0000000001000000","1000000000000000","0000000000000000","0000000000000000","0000000000000010","1000000000000000","0000000000000000","0100000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000"}

    Returns: {7, 3, 13, 11, 10, 0, 2, 6, 4, 14, 9, 1, 8, 12, 5, 15 }

  49. {310,94,866,635,113,163,896,96,669,413,919,317,75,503,307,777}

    {"0000000000000000","0000000000000000","0000000000010000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","1100000000000000","0000000010000000"}

    Returns: {10, 6, 8, 15, 3, 11, 2, 13, 9, 0, 1, 14, 5, 4, 7, 12 }

  50. {166,224,452,678,436,956,536,719,401,398,135,553,331,515,102,841}

    {"0000000000000000","0000000000000000","0000100000000000","0000000010000000","0000000000000000","0000000000000000","0010000000000001","0000000000000000","0000000000000000","0000000100000000","0000000000000000","0000100000000000","0000000000000000","1000000000000000","0000000000000000","0000000000000000"}

    Returns: {5, 15, 7, 8, 3, 4, 11, 2, 6, 9, 0, 13, 12, 1, 10, 14 }

  51. {539,42,593,380,27,32,800,312,554,818,700,848,947,546,836,653}

    {"0000000000000010","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000010","0000000000000000","0000000000000000","0010000000000000","0000000000000010","0000000000000000","0000000000000000","0000000000000000","0000000100000000","0000000000000000","0100000000000000"}

    Returns: {12, 11, 14, 9, 6, 10, 2, 8, 0, 7, 13, 3, 1, 15, 5, 4 }

  52. {621,561,100,272,813,763,981,220,544,312,403,913,44,686,707,787}

    {"0000000000000000","0000000000000000","0000000000000000","0000001000000000","0000000000000000","0000000000000000","0000000000000000","1000000001000000","0000000000000000","0000010000000000","0000000000000000","0000000000000000","0000000000000000","0000000000100000","0000000000000000","0000000000000000"}

    Returns: {6, 11, 4, 15, 5, 14, 0, 1, 10, 13, 8, 9, 3, 7, 2, 12 }

  53. {268,794,425,128,206,339,585,997,971,956,819,973,122,377,315,206}

    {"0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000001010000","0000000000000000","0000000001000000","0000000000010000","0000001000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0001000000000000","0000000000000000","0000000000000000"}

    Returns: {11, 7, 9, 10, 1, 6, 8, 2, 5, 14, 0, 3, 13, 4, 15, 12 }

  54. {417,747,746,925,924,728,942,132,47,986,620,698,381,438,999,235}

    {"0000000000000000","0000000000000000","0000000000100000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0000000000000000","0001000000000000","0000000000000000","0000100000000001","0000010000000000","0001000000000000"}

    Returns: {9, 6, 3, 4, 5, 14, 1, 11, 10, 2, 0, 12, 15, 13, 7, 8 }

  55. {460,816,48,665,741,901,583,950,902,709,118,875,891,252,880,782}

    {"0010000010000000","1010100011110000","0001000001000000","0000000001000000","0000000011100000","1110000111100101","1100100010100100","1010101010010101","0000000000000000","0000000000000000","1010000000010000","1011000000000000","1001010010110011","0010000010000000","0110001001100100","0110000011000000"}

    Returns: {8, 9, 3, 2, 0, 11, 10, 4, 1, 15, 13, 6, 7, 5, 14, 12 }

  56. {623,122,470,227,448,985,769,475,690,396,704,964,32,968,353,210}

    {"0101001001000000","0000010111101100","0001001000000100","0000000000000000","1110010001000100","0000001010100000","0000000000000000","0000001011000100","0000000001000000","0000001000000000","0000001000000000","0110010111101101","0000000000000000","0001000010000000","0101001000001000","0100011011000110"}

    Returns: {6, 10, 9, 8, 5, 3, 13, 7, 2, 12, 1, 0, 14, 15, 11, 4 }

  57. {247,340,145,816,412,55,848,163,198,904,851,223,261,505,574,697}

    {"0010101001100000","1010100100010010","0000101000100000","1010100111011010","0000000000000000","0110100110000000","0000000000000000","1010001010101101","0010100000000100","0000000000000000","0000100001000000","1000001001100001","0000101010100100","0000000001100000","0000101000100100","0000000001000110"}

    Returns: {9, 6, 4, 10, 13, 14, 15, 2, 0, 8, 12, 11, 7, 3, 1, 5 }

  58. {249,120,121,466,213,481,204,919,455,640,512,598,828,705,394,444}

    {"0000101010100000","1000100010010010","1101100010010010","0000101000000000","0000000001010000","1101000001110000","0000100001000000","0001010000110000","0000000000000000","0000000000010000","0001100011010000","0000000000000000","1110000011100000","0101001011011010","0000101011000000","0101000011110100"}

    Returns: {11, 9, 8, 4, 6, 3, 10, 14, 0, 1, 5, 7, 2, 12, 13, 15 }

  59. {148,669,41,354,905,727,277,804,345,299,575,374,475,240,509,580}

    {"0010001000001000","0000011000000101","0000000000000000","0000010000000000","0001011111100011","0000000000000000","0010010100000101","0010000000000100","0000001000001001","0101001110100001","1110011010001101","1111010111000100","0010010100000000","0000010000000000","1000011110100000","0000000000000000"}

    Returns: {5, 15, 13, 2, 7, 12, 6, 1, 8, 0, 10, 14, 3, 9, 4, 11 }

  60. {799,374,98,368,217,545,509,206,297,240,821,37,186,567,433,690}

    {"0000010000000000","0000000000000000","1100100010000010","0000001000011010","0000010000000010","0000000000000000","0000010010001000","1010110010110110","0000010000000000","1011001000110111","0101000010001010","1100010010000000","0000000000000000","1100000000000000","1000000010000100","1000110010101100"}

    Returns: {5, 0, 1, 13, 8, 14, 12, 6, 11, 3, 10, 4, 15, 2, 9, 7 }

  61. {679,48,878,309,585,715,571,486,504,569,348,79,97,670,425,514}

    {"0100000000000001","0000000000000000","1100000011000001","0000001000010100","0100010000011001","0100001010001000","0000000000000000","0110001001001001","1000000000000000","0000000000000000","0011001011001100","1000000001000001","1100001001000000","0000001011001000","1100101001010001","0100001001000000"}

    Returns: {6, 9, 1, 15, 0, 8, 2, 12, 5, 13, 7, 11, 4, 14, 3, 10 }

  62. {794,521,311,919,142,554,534,5,107,638,456,333,201,766,460,857}

    {"0000000000010000","1011011010010000","0000000000110010","1000000001000010","0010000001100111","0000000001000010","0010000001111000","0010111001111010","0000111001001111","0000000000000000","0000000000000000","0000000001100000","1000000000010000","1000010001000010","0000000000000000","1000010000100000"}

    Returns: {9, 10, 11, 0, 14, 3, 5, 15, 13, 2, 12, 6, 4, 8, 1, 7 }

  63. {298,244,539,939,643,194,784,793,1000,866,957,288,563,357,999,917}

    {"0000000000000000","1000010100100100","0000010100000110","1110000001011101","1010011011000111","0000000000000000","0000000100110100","1000010000100000","1100000100000000","0010001010100000","1000000000000000","0000000100000000","0100000001100110","0000010100100000","1000010100010100","0110000010000010"}

    Returns: {0, 10, 5, 7, 13, 11, 14, 6, 1, 8, 2, 15, 9, 12, 3, 4 }

  64. {387,961,991,647,167,588,781,956,906,160,90,914,822,161,234,921}

    {"0000000000011100","1001010010101000","0000100101000001","0000100010010000","0000000010000000","0001100000110100","1001000000001000","1000011010000101","0000000000000000","0101111110001100","0001100000011100","0000100000000000","0000100000010100","0000100000000000","0001010010000100","0000010010101000"}

    Returns: {8, 4, 11, 3, 13, 12, 0, 6, 10, 5, 1, 15, 7, 9, 2, 14 }

  65. {891, 67, 455, 663, 626, 563, 110, 374, 325, 227, 463, 71, 603, 738, 401, 688 }

    {"0000000000000000", "0000000000000000", "0000000000000000", "0000000000100000", "0000000000000010", "0000001000000000", "0000000000000000", "0000000000000000", "0000000000000000", "0000000100000000", "0000000000000000", "0100000000000000", "0100000010000000", "0000000110000000", "0000001000100000", "0000001000100000" }

    Returns: {0, 10, 3, 7, 8, 13, 6, 15, 5, 14, 4, 2, 1, 12, 9, 11 }


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: