Connection Status:
Competition Arena > BuildingHeights
SRM 624 · 2013-12-22 · by MDantas · Greedy, Search, Simple Math, Sorting
Class Name: BuildingHeights
Return Type: int
Method Name: minimum
Arg Types: (vector<int>)
Problem Statement

Problem Statement

Byteland is a city with many skyscrapers, so it's a perfect venue for BASE jumping. Danilo is an enthusiastic BASE jumper. He plans to come to Byteland and to jump off some of its buildings.


Danilo can make arbitrarily many jumps in Byteland. However, he has some rules. First, he never jumps off the same building twice. Second, all buildings he selects for his jumps must have the same number of floors. (This is for safety reasons: It is hard to get the timing right if each jump starts at a different height.)


Philipe is the mayor of Byteland. He welcomes Danilo's visit as he would like to use it as a publicity stunt. Of course, the more jumps Danilo makes, the better the publicity will be. But what if there aren't enough buildings with the same height? To avoid this issue, the mayor is willing to prepare the town for Danilo's visit. Before Danilo arrives, Philipe wants to build additional floors on some of the skyscrapers in Byteland.


You are given a int[] heights. Each element of heights is the number of floors in one of Byteland's skyscrapers. Let N be the number of elements in heights. For each M between 1 and N, inclusive, answer the following question: What is the smallest number of additional floors the mayor has to build so that there will be at least M buildings with the same number of floors?


For each i between 1 and N, inclusive, let A[i] be the answer to the above question for M = i. Return the value (A[1] XOR A[2] XOR ... XOR A[N]).

Notes

  • You may assume that the correct return value always fits into a signed 32-bit integer variable.
  • Each question should be answered independently of the others. For example, when trying to produce four buildings with the same number of floors, you do not have to start from the optimal solution for three buildings.

Constraints

  • heights contains between 1 and 4,000 elements, inclusive.
  • Each element of heights will be between 1 and 4,000, inclusive.
Examples
0)
{1, 5, 4, 3, 8}
Returns: 22

Danilo can jump off a building without any changes to the city. To get two equally tall buildings we need to build one additional floor. For example, we can increase building #2 (0-based index) from 4 to 5 floors. To get three equally tall buildings we need to build three additional floors: one on building #2 and two on building #3. This way, the buildings #1, #2, and #3 will have 5 floors each. To get four equally tall buildings we need to build seven additional floors. Making all five buildings equally tall requires us to build 19 additional floors.

1)
{1, 2, 3}
Returns: 2
2)
{3, 4, 1, 6, 8, 1}
Returns: 21
3)
{43, 1191, 1283, 1535, 1347, 1670, 1017, 1154, 147, 2058, 2245, 2133, 1517, 233, 1481, 1162, 2300, 2338, 2337, 1876, 1009, 1988, 1458, 531, 1071, 1769, 2093, 1254, 893, 1769, 254, 936, 460, 388, 2470, 1806, 2057, 986, 459, 2204, 1895, 1556, 688, 911, 640, 2169, 924, 439, 2006, 760, 1167, 1866, 1599, 124, 2396, 169, 744, 1988, 1422, 1637, 108, 527, 1424, 567, 2267, 1393, 1225, 1823, 1230, 1683, 378, 624, 2090, 1066, 1534, 230, 734, 1309, 668, 239, 920, 1834, 956, 18, 810, 2203, 1538, 405, 1690, 1812, 893, 649, 1190, 2316, 1216, 956, 60, 2440, 279, 1289, 474, 656, 1912, 64, 573, 2297, 1645, 1306, 1105, 2312, 396, 876, 498, 1351, 893, 1307, 1053, 1283, 563, 1594, 594, 1456, 2243, 1783, 1271, 2310, 239, 1331, 1101, 1869, 119, 1574, 1376, 2031, 489, 1949, 679, 2133, 754, 1784, 797, 2, 159, 1294, 1352, 2404, 1452, 1257, 1186, 2014, 1702, 631, 969, 1444, 2413, 2240, 105, 1503, 2422, 1205, 871, 1392, 1631, 1099, 2274, 2119, 547, 453, 1752, 152, 2236, 48, 153, 1246, 193, 1505, 1, 1644, 1613, 38, 1157, 814, 668, 2126, 1110, 1933, 717, 1214, 2287, 1990, 2419, 658, 881, 1549, 608, 655, 19, 1154, 1107, 622, 1305, 2194, 2021, 1458, 2291, 2213, 1814, 1144, 1356, 926, 1181, 1365, 1739, 701, 2342, 348, 1485, 558, 414, 1271, 1399, 1684, 780, 2279, 2084, 1387, 1785, 2102, 40, 1743, 224, 197, 288, 2244, 1654, 1431, 809, 2319, 74, 1016, 744, 106, 2380, 1334, 806, 2221, 534, 1142, 1630, 947, 2413, 528, 1482, 2044, 1659, 1065, 931, 943, 666, 2322, 1538, 2241, 1370, 677, 1985, 1875, 2107, 1645, 1693, 2180, 160, 1288, 2286, 40, 122, 1943, 1112, 2007, 585, 242, 1805, 1849, 769, 786, 244, 1279, 1850, 26, 1074, 1367, 2348, 111, 1108, 69, 787, 1944, 1944, 394, 1088, 2488, 1425, 1247, 1276, 62, 138, 249, 2005, 1250, 2255, 1441, 1491, 411, 2141, 1111, 1196, 2384, 2390, 1897, 2410, 963, 763, 1109, 2425, 1870, 1177, 711, 165, 1972, 2456, 1252, 1960, 1381, 2499, 735, 294, 1488, 983, 2298, 237, 2089, 90, 1727, 2499, 1082, 1690, 46, 966, 1579, 794, 2227, 1393, 1556, 835, 1317, 2278, 863, 879, 2442, 1687, 835, 46, 1146, 1067, 1396, 732, 212, 383, 566, 10, 620, 1506, 1451, 1198, 356, 33, 387, 401, 2350, 817, 1194, 2076, 2209, 1601, 1762, 2377, 230, 1476, 756, 1524, 662, 442, 1569, 659, 360, 464, 1390, 571, 846, 807, 1932, 317, 2312, 2235, 1515, 167, 2267, 753, 1919, 968, 422, 612, 543, 1482, 1065, 1156, 1359, 1294, 1483, 966, 317, 997, 259, 737, 1655, 618, 1200, 1897, 40, 898, 203, 824, 66, 1367, 558, 432, 1533, 1676, 1185, 952, 143, 458, 415, 2037, 1939, 331, 2044, 2149, 1625, 1026, 614, 793, 2022, 872, 1530, 29, 341, 1581, 1925, 1733, 1330, 979, 56, 1396, 1197, 613, 1827, 230, 1140, 1863, 33, 134, 2320, 1799, 2170, 1759, 2130, 565, 259, 106, 1590, 873, 898, 2464, 596, 1279, 2492, 937, 360, 768, 169, 541, 598, 1576, 1936, 1795, 1040, 1263, 876, 2179, 625, 908, 2312, 1797, 206, 833, 2407, 1187, 249, 165, 1292, 690, 1037, 2190, 653, 485, 2320, 1996, 273, 1531, 1615, 441, 2072, 2213, 868, 1507, 359, 1907, 1621, 1234, 437, 2246, 993, 248, 394, 1198, 2432, 300, 1237, 1532, 464, 28, 2221, 353, 1069, 1726, 837, 889, 1221, 1109, 2419, 1688, 401, 1990, 252, 1268, 2349, 610, 2026, 1469, 1843, 2462, 1214, 335, 1561, 459, 384, 344, 758, 1620, 1875, 1222, 500, 1595, 426, 1568, 820, 114, 2456, 893, 74, 1227, 1432, 1826, 2068, 1683, 1945, 1916, 2292, 1470, 885, 486, 1431, 950, 820, 491, 1409, 55, 2186, 2166, 1675, 1560, 2239, 2174, 2006, 164, 93, 1678, 277, 1401, 70, 1702, 127, 353, 1027, 2194, 2035, 471, 1610, 1826, 1940, 2494, 2311, 2222, 2295, 1982, 1564, 1203, 2036, 1249, 869, 62, 308, 607, 1087, 2314, 2123, 1180, 1491, 1251, 1432, 412, 453, 1558, 764, 1479, 103, 1650, 1950, 564, 2327, 241, 1909, 989, 2463, 1704, 470, 1526, 406, 5, 275, 126, 1419, 1934, 2085, 5, 599, 1707, 36, 941, 457, 1467, 204, 2261, 1876, 967, 1240, 1979, 1468, 2041, 1394, 1294, 2281, 2155, 2282, 1095, 1358, 251, 121, 615, 1608, 1747, 741, 1878, 1180, 325, 1882, 631, 883, 1918, 1571, 191, 884, 1775, 2452, 260, 1593, 43, 1090, 561, 2083, 1335, 1854, 715, 989, 488, 1810, 1198, 2090, 782, 1813, 49, 28, 1405, 1926, 59, 581, 1308, 689, 1463, 2077, 2260, 1653, 1812, 1534, 456, 923, 626, 498, 864, 38, 1432, 2199, 744, 999, 687, 1231, 1660, 737, 2172, 2441, 49, 2221, 2468, 1453, 1646, 1378, 885, 1805, 2067, 2347, 233, 1826, 351, 2045, 2211, 807, 467, 1688, 156, 183, 1726, 1588, 2381, 1321, 86, 1919, 51, 1745, 155, 2222, 537, 1555, 794, 1856, 1859, 2440, 733, 243, 596, 299, 89, 829, 976, 1792, 1725, 686, 98, 1043, 2374, 253, 1225, 451, 692, 1105, 1771, 2129, 1876, 673, 225, 2030, 1746, 761, 1085, 1392, 116, 443, 183, 849, 2038, 778, 2499, 978, 458, 975, 269, 2182, 1660, 366, 725, 385, 1971, 801, 2187, 162, 758, 309, 1143, 133, 2333, 1367, 1014, 431, 980, 950, 1822, 1095, 245, 2004, 795, 2282, 1633, 794, 759, 2091, 620, 1028, 624, 1131, 245, 200, 368, 1067, 1001, 1406, 81, 1758, 1715, 1223, 1890, 399, 89, 403, 829, 2420, 205, 150, 1015, 449, 1005, 661, 230, 138, 306, 988, 2228, 925, 867, 351, 908, 1112, 551, 1275, 2178, 403, 180, 2258, 2160, 746, 2332, 401, 1145, 1273, 803, 1973, 1192, 2359, 975, 2206, 307, 1979, 1719, 536, 2116, 2024, 376, 1843, 1801, 1242, 1046, 208, 1205, 448, 334, 883, 850, 513, 1992, 509, 111, 1824, 909, 1255, 596, 563, 2079, 1787, 422, 553, 345, 728, 1384, 915, 116, 999, 438, 491, 1694, 1090, 1732, 1591, 149, 437, 2038, 1834, 171, 1739, 1199, 1014, 2247, 1309, 337, 2007, 63, 2284, 1421, 993, 423, 694, 1546, 2119, 274, 1781, 533, 389, 1631, 2322, 2231, 824, 912, 1462, 1266, 2412, 750, 803, 1746, 2272, 41, 444, 786, 1139, 1752, 2474, 1997, 666, 1110, 918, 1658, 1532, 463, 2055, 1150, 736, 1335, 1682, 1124, 466, 355, 2206, 141, 118, 20, 1407, 30, 769, 1061, 627, 1893, 2454, 1070, 178, 1092, 1673, 1503, 1941, 1190, 112, 358, 1699, 495, 820, 1254, 1644, 408, 1440, 2177, 383, 757, 32, 89, 2250, 149, 108, 8, 1530, 876, 1068, 2156, 1620, 2373, 2077, 649, 2317, 101, 2152, 1757, 1290, 2263, 966, 489, 258, 637, 594, 753, 1044, 885, 1782, 1427, 494, 665, 1515, 243, 2165, 1622, 1602, 1195, 1349, 1521, 2202, 469, 1394, 631, 2469, 1210, 731, 2120, 1818, 873, 735, 283, 213, 2344, 919, 806, 1948, 815, 542, 1229, 2241, 1035, 1893, 107, 129, 1558, 580, 1730, 1604, 1928, 751, 157, 1248, 2144, 787, 1217, 2205, 1518, 2188, 1522, 1242, 422, 656, 1454, 265, 426, 2259, 1065, 1240, 1652, 2293, 2332, 187, 538, 2438, 315, 2095, 517, 2045, 50, 1297, 295, 206, 1396, 1290, 993, 112, 2346, 1362, 2300, 219, 103, 1573, 874, 408, 690, 151, 166, 1754, 1391, 1817, 398, 74, 855, 935, 12, 1170, 1881, 1880, 2066, 1930, 676, 2360, 2136, 2072, 1, 1980, 1035, 2346, 2193, 2186, 1416, 2295, 1259, 2289, 202, 800, 1291, 1719, 1405, 181, 2387, 1802, 255, 2094, 237, 1618, 763, 2117, 2349, 328, 1547, 525, 1539, 34, 1448, 391, 865, 1334, 1588, 557, 1020, 503, 1703, 1130, 291, 756, 781, 1581, 1326, 2185, 614, 64, 1486, 2220, 2157, 1722, 189, 419, 191, 37, 2098, 589, 1913, 2488, 622, 2212, 378, 338, 1046, 1965, 2246, 917, 2467, 1448, 2046, 1609, 2203, 1678, 2042, 2380, 1362, 1507, 2443, 347, 78, 2100, 921, 266, 1370, 1111, 1654, 968, 1699, 1067, 955, 1172, 778, 185, 361, 1823, 1001, 106, 1591, 968, 1553, 2488, 1428, 107, 1665, 2321, 2486, 526, 1327, 2428, 2225, 256, 879, 1997, 521, 2249, 607, 1027, 2068, 1157, 2093, 1874, 1180, 1722, 2058, 1540, 2397, 559, 1645, 1487, 378, 2049, 1475, 657, 1007, 639, 478, 992, 17, 656, 2271, 1093, 912, 2002, 589, 284, 1750, 47, 1310, 1317, 1203, 2254, 690, 1234, 1476, 1600, 273, 224, 2158, 769, 1710, 1387, 1669, 684, 2043, 175, 175, 20, 18, 1543, 2028, 1140, 135, 1791, 641, 2075, 926, 2390, 2121, 2236, 58, 2175, 841, 748, 2260, 1168, 1199, 32, 1391, 856, 2152, 601, 2242, 1320, 136, 636, 346, 1662, 2008, 363, 2056, 1535, 1502, 2190, 2177, 995, 616, 602, 884, 1588, 337, 2294, 1262, 30, 1893, 1021, 1197, 591, 2404, 1440, 298, 907, 2040, 39, 1078, 1027, 2026, 1423, 1541, 1533, 1785, 1096, 1919, 2139, 2138, 1595, 633, 253, 2197, 368, 1841, 1385, 161, 1954, 1414, 2053, 1827, 1463, 1495, 1730, 402, 1792, 1489, 1293, 682, 66, 1171, 208, 1489, 211, 1740, 2125, 1307, 11, 1763, 2296, 1605, 2395, 48, 153, 263, 1888, 1538, 1775, 194, 1803, 180, 2020, 2117, 1674, 101, 1370, 966, 1589, 1514, 1647, 1655, 185, 1854, 1995, 1747, 2446, 1619, 1905, 2456, 2234, 1700, 412, 2128, 1748, 565, 1242, 2487, 954, 1869, 180, 1608, 2048, 2199, 1225, 1221, 1152, 1446, 1038, 240, 460, 185, 746, 1996, 890, 240, 1242, 835, 711, 647, 2142, 444, 2346, 54, 1423, 445, 1970, 1517, 1784, 1775, 885, 815, 882, 1784, 514, 958, 504, 517, 2404, 1542, 756, 1715, 578, 1502, 1210, 1467, 593, 2451, 2302, 1303, 1949, 795, 1746, 647, 2200, 2021, 2443, 1669, 1037, 1726, 2295, 773, 41, 677, 56, 1906, 486, 559, 2422, 1741, 952, 2029, 955, 381, 1030, 2164, 1848, 1623, 967, 501, 1777, 1767, 1295, 2375, 1265, 995, 1895, 1208, 1515, 431, 433, 1310, 1203, 1825, 838, 1258, 1230, 1323, 668, 3, 564, 472, 2032, 370, 852, 1913, 1386, 1551, 2387, 1204, 2051, 1664, 470, 846, 1538, 1735, 1840, 932, 442, 2206, 214, 2226, 1015, 268, 1551, 704, 377, 1632, 2027, 2396, 487, 1442, 367, 1370, 1811, 71, 782, 696, 1621, 669, 751, 1172, 1184, 1221, 869, 221, 455, 208, 4, 2248, 1265, 217, 825, 2280, 1836, 1227, 483, 2212, 359, 1361, 2107, 2197, 1654, 1326, 1066, 965, 248, 699, 512, 1868, 1367, 1263, 1891, 50, 1335, 259, 1622, 641, 1818, 1625, 388, 583, 693, 1212, 1714, 28, 2439, 1048, 1091, 1649, 2409, 698, 197, 1562, 875, 1262, 1378, 1122, 1960, 742, 1841, 2179, 856, 1232, 1080, 2190, 342, 202, 330, 1012, 678, 2069, 1594, 223, 2132, 2159, 1602, 922, 706, 193, 1422, 1966, 2242, 1618, 2380, 1968, 1731, 109, 589, 43, 850, 2429, 2221, 1705, 12, 2152, 246, 1706, 1205, 1927, 217, 735, 347, 662, 957, 2479, 320, 1410, 2252, 2377, 454, 1174, 695, 1547, 1643, 574, 1014, 2226, 682, 1602, 2268, 384, 383, 840, 940, 394, 491, 1186, 2099, 1696, 1964, 1167, 1282, 2311, 1828, 2238, 2289, 999, 2499, 892, 876, 453, 2065, 1570, 1999, 60, 995, 1865, 2285, 528, 966, 2052, 911, 200, 1743, 1851, 594, 2233, 1888, 1544, 280, 1351, 211, 1561, 1161, 890, 150, 2301, 1889, 149, 693, 264, 1953, 1609, 685, 303, 520, 531, 2167, 304, 1058, 1985, 1207, 821, 2184, 449, 1523, 1629, 1534, 910, 2025, 1813, 1112, 1087, 2226, 1125, 1976, 2375, 2277, 1364, 1375, 469, 479, 827, 930, 15, 2482, 301, 545, 1000, 1957, 455, 484, 663, 1275, 1520, 2464, 297, 648, 349, 58, 172, 1013, 1169, 1258, 738, 1145, 734, 1965, 922, 949, 839, 242, 1428, 518, 1171, 294, 499, 324, 2191, 1498, 2280, 145, 834, 1794, 271, 2353, 1757, 1919, 500, 2105, 1976, 2024, 618, 1996, 2133, 207, 641, 1718, 2171, 414, 167, 510, 655, 446, 2379, 678, 739, 1729, 1001, 429, 2078, 780, 1925, 411, 73, 2195, 263, 682, 1613, 2115, 1638, 2440, 490, 2255, 788, 122, 1314, 280, 1840, 984, 693, 858, 345, 1347, 1303, 223, 876, 893, 1951, 1876, 174, 1529, 1507, 2098, 1939, 432, 645, 1054, 1113, 1109, 2020, 250, 1049, 9, 1357, 1836, 1482, 170, 967, 2173, 1153, 1659, 530, 350, 1857, 684, 572, 233, 429, 23, 960, 602, 403, 2467, 1551, 1193, 398, 2195, 2246, 362, 2156, 617, 611, 704, 1977, 819, 1391, 959, 988, 2357, 1983, 993, 367, 1365, 1342, 2223, 2048, 765, 1307, 1328, 787, 2267, 781, 41, 1085, 2332, 1234, 334, 878, 979, 695, 533, 448, 157, 88, 2424, 976, 1478, 2234, 815, 186, 1717, 1807, 552, 1933, 2000, 275, 1480, 265, 1581, 1660, 2403, 199, 2440, 2444, 1283, 2271, 1177, 1616, 2001, 1007, 1162, 33, 1454, 1319, 1473, 230, 2294, 450, 1315, 1960, 636, 531, 1267, 1187, 2463, 2118, 313, 295, 1234, 746, 806, 1137, 944, 745, 2432, 1079, 1868, 2460, 1546, 1368, 966, 208, 252, 1272, 378, 1724, 353, 1523, 1026, 1667, 982, 1661, 2198, 1100, 1699, 1012, 718, 864, 158, 1951, 1609, 963, 1939, 1404, 1708, 1870, 2482, 2427, 1829, 1528, 1294, 1647, 587, 397, 1770, 964, 2121, 2122, 2486, 1998, 1288, 967, 10, 985, 919, 1708, 849, 1636, 1423, 2358, 2438, 1883, 821, 729, 787, 1380, 1450, 2120, 158, 2131, 2499, 1451, 1277, 585, 699, 546, 1548, 319, 167, 385, 2316, 1454, 204, 1177, 1291, 1122, 1737, 991, 1609, 659, 848, 1546, 42, 520, 1126, 2180, 751, 76, 1799, 908, 2206, 1798, 1210, 2334, 2382, 1909, 379, 282, 1079, 1897, 2018, 2247, 2202, 2221, 923, 2344, 842, 159, 2186, 1302, 2170, 1886, 1700, 2211, 2405, 325, 1890, 2008, 400, 1188, 1767, 1457, 1837, 1829, 1290, 1719, 1237, 520}
Returns: 3478926
4)
{2416, 369, 913, 970, 90, 688, 2165, 2283, 2198, 1851, 2437, 1867, 1236, 1636, 1577, 2492, 1960, 2318, 1999, 2360, 2358, 118, 168, 1694, 1946, 1458, 2264, 2034, 1977, 615, 2052, 745, 984, 1817, 1714, 2425, 4, 1378, 1059, 2201, 2080, 995, 420, 815, 1482, 1996, 807, 942, 666, 1657, 2153, 523, 1774, 2320, 1068, 71, 1277, 832, 2104, 2106, 298, 1656, 350, 1281, 972, 915, 57, 2327, 1144, 2468, 879, 724, 2314, 1298, 1538, 1296, 2146, 2344, 1089, 1663, 353, 741, 2185, 2126, 1912, 2104, 2197, 689, 1787, 652, 1646, 2085, 1159, 1995, 865, 982, 1761, 2274, 2160, 404, 1093, 539, 1127, 906, 688, 1517, 1053, 333, 212, 2141, 1995, 564, 381, 531, 1542, 2293, 1487, 90, 1833, 773, 2093, 978, 357, 752, 1824, 74, 585, 1084, 2347, 245, 1487, 939, 2135, 1466, 696, 1674, 1834, 1749, 2007, 2045, 1389, 353, 1461, 622, 2236, 502, 414, 1222, 591, 1098, 1994, 183, 927, 2351, 2286, 250, 2424, 371, 185, 1122, 1967, 1671, 912, 453, 1988, 1607, 2126, 1321, 855, 484, 2218, 1096, 837, 1178, 1717, 1924, 1679, 982, 645, 1121, 2079, 1490, 155, 505, 1340, 2441, 2106, 115, 1663, 2290, 88, 2481, 312, 999, 1785, 2300, 1458, 1410, 2472, 1164, 746, 2189, 2259, 434, 2218, 1475, 2357, 248, 2456, 501, 1368, 886, 1990, 1523, 1390, 2182, 315, 2347, 1148, 1977, 2136, 1236, 809, 1300, 1086, 93, 2451, 43, 1502, 2422, 1207, 1099, 963, 965, 1532, 680, 1292, 1388, 928, 1247, 1888, 1147, 2133, 230, 1521, 2374, 1263, 1835, 1073, 2410, 163, 2060, 2497, 971, 859, 1083, 1063, 809, 2477, 1417, 2083, 35, 15, 545, 2352, 1547, 76, 1143, 434, 2355, 1241, 1174, 1002, 873, 255, 1374, 2099, 1517, 709, 2023, 278, 2223, 1582, 275, 694, 1293, 209, 608, 953, 185, 2024, 535, 1572, 891, 2431, 1423, 1289, 7, 65, 1722, 1213, 1305, 1747, 1066, 1030, 853, 2440, 1980, 2369, 2000, 1502, 147, 1722, 1935, 1773, 1267, 727, 1981, 1875, 1680, 1017, 250, 2214, 88, 1140, 997, 1510, 2428, 2355, 426, 502, 1067, 1731, 1100, 985, 260, 1953, 924, 1091, 673, 423, 92, 2171, 996, 2026, 1443, 2263, 1605, 2275, 1637, 784, 2144, 1886, 1849, 1083, 1878, 345, 1445, 657, 1551, 1870, 10, 118, 2452, 1110, 2454, 1563, 1914, 877, 153, 86, 151, 1596, 2257, 1146, 1122, 51, 2260, 226, 1178, 1396, 2361, 821, 2134, 1709, 755, 363, 906, 2199, 1019, 1308, 421, 1029, 277, 372, 990, 230, 1935, 403, 1106, 939, 488, 108, 35, 244, 106, 8, 1647, 2365, 1585, 324, 113, 1445, 2496, 1098, 2005, 750, 1460, 1762, 1801, 2478, 570, 2221, 2358, 846, 1444, 847, 1076, 878, 1249, 1033, 669, 589, 2493, 703, 2184, 98, 2062, 1330, 2462, 1146, 1653, 1426, 1442, 1648, 23, 2298, 1250, 1482, 412, 550, 312, 2333, 270, 1521, 678, 565, 2368, 605, 1443, 2468, 490, 963, 556, 482, 517, 240, 579, 78, 421, 1892, 75, 2074, 818, 368, 73, 840, 165, 174, 1174, 1928, 723, 337, 1760, 2344, 1857, 1290, 409, 576, 1894, 703, 544, 1235, 1665, 2451, 568, 1033, 190, 2498, 1110, 611, 1890, 36, 1536, 1559, 403, 460, 1250, 567, 634, 2423, 2495, 1356, 259, 606, 52, 968, 1895, 460, 1543, 141, 14, 2086, 1375, 530, 2037, 1943, 1562, 1078, 1940, 171, 540, 181, 206, 2075, 1739, 608, 35, 1841, 26, 668, 1763, 1372, 875, 874, 1978, 2278, 1841, 224, 237, 2235, 364, 1602, 1821, 1739, 2131, 209, 33, 1192, 1286, 824, 214, 1826, 1005, 1771, 252, 1595, 1230, 1638, 935, 1256, 2305, 1550, 1479, 2032, 1275, 2308, 1809, 1967, 32, 898, 1701, 395, 2499, 2373, 985, 982, 81, 2369, 2173, 219, 693, 2387, 896, 549, 509, 1147, 995, 1739, 285, 782, 1846, 1441, 2331, 824, 2324, 1105, 1984, 485, 1923, 867, 234, 1123, 113, 232, 996, 1098, 1213, 2428, 2318, 2238, 1498, 1862, 976, 2393, 1262, 1484, 2392, 2257, 722, 1528, 538, 67, 1820, 1720, 2243, 1644, 1676, 578, 980, 1098, 1444, 1213, 1072, 1556, 296, 919, 1505, 361, 847, 175, 98, 1196, 2036, 2425, 1089, 798, 1408, 2332, 554, 982, 1359, 2443, 2400, 678, 1662, 994, 1173, 2189, 1571, 2152, 786, 1866, 864, 1857, 2274, 12, 1628, 1278, 372, 2474, 1452, 469, 1169, 2340, 1745, 1109, 637, 652, 940, 42, 1633, 1150, 2484, 385, 680, 497, 1378, 1852, 185, 449, 356, 2322, 2314, 71, 530, 939, 82, 2157, 2217, 453, 982, 20, 2273, 1003, 2359, 1517, 2111, 1847, 2169, 1903, 1888, 153, 1904, 723, 1889, 83, 71, 767, 787, 255, 67, 1142, 1428, 1232, 1212, 1958, 2171, 1294, 466, 1887, 1746, 1448, 758, 1519, 2450, 1969, 1887, 912, 167, 1555, 1666, 2055, 560, 1070, 1629, 2448, 4, 1700, 714, 790, 806, 2132, 1931, 2234, 864, 1995, 543, 534, 788, 1008, 1272, 1385, 1307, 2029, 1755, 108, 349, 1142, 1020, 516, 1548, 1537, 1422, 2107, 106, 1902, 907, 1462, 1101, 472, 2251, 759, 104, 534, 1844, 967, 28, 1238, 352, 815, 1097, 1623, 1051, 2404, 1151, 306, 11, 352, 1447, 2382, 867, 1846, 1419, 1140, 305, 376, 541, 1211, 1837, 494, 534, 440, 104, 1989, 973, 1947, 455, 1000, 2036, 806, 666, 632, 1280, 1716, 535, 1283, 873, 1898, 1634, 2319, 1779, 1352, 517, 2049, 2491, 821, 2425, 1883, 2031, 613, 1228}
Returns: 475975

Submissions are judged against all 58 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class BuildingHeights with a public method int minimum(vector<int> heights) · 58 test cases · 2 s / 256 MB per case

Submitting as anonymous