Statistics

Problem Statement for "CinderellaGirls"

Problem Statement

There are N girls auditioning for an idol competition. You are a junior producer of the competition. During the auditions you have evaluated the talent and the skill of each candidate. The results of these evaluations are given in the int[]s talent and skill: for each valid i, talent[i] is the amount of talent and skill[i] the amount of skill candidate i has shown.

Your task is to decide which girls advance to the second stage of the selection process. In order to do this, you came up with a simple rule: girl A will advance if and only if there is no other girl B such that B has both strictly more talent and strictly more skill than A.

Please calculate and return the number of girls who advance to the second stage.

Definition

Class:
CinderellaGirls
Method:
count
Parameters:
int[], int[]
Returns:
int
Method signature:
int count(int[] talent, int[] skill)
(be sure your method is public)

Constraints

  • N will be between 2 and 50, inclusive.
  • talent will contain exactly N elements.
  • skill will contain exactly N elements.
  • Each element in talent will be between 1 and 10,000, inclusive.
  • Each element in skill will be between 1 and 10,000, inclusive.

Examples

  1. {10,20,30}

    {30,20,10}

    Returns: 3

    Every girl will be accepted.

  2. {10,20,30}

    {10,20,30}

    Returns: 1

    In this case, girls 0 and 1 will not be accepted because girl 2 has more talent and more skill than each of the other two.

  3. {10,10,10}

    {1,100,10000}

    Returns: 3

    Their skill scores differ significantly but their talent scores are the same so every girl will be invited to the second stage.

  4. {46,70,39,53,10,47,73,95,95,27}

    {81,47,64,65,34,55,75,16,80,69}

    Returns: 3

  5. {6271,40,2988,444,5004,5298,8607,9364,2810,2691,7346,1330,4727,8832,6106,5973,9126,8630,402,5497,2515,2794,7316,4329,4061,5414,3377,2296,8544,1387,924,1015,9634,7487,252,6411,2292,2490,1624,6015,5690,72,9291,7284,2257,3211,1267,8659,4744,8993}

    {3359,2539,3712,6014,3838,5782,9174,3752,5545,6000,3929,1238,9336,7139,7606,3855,7239,3143,8385,3405,8253,6906,7119,4080,7865,9627,9891,4279,6867,9885,5009,9418,9234,5979,4994,7721,1759,4153,161,3704,766,6763,7597,9049,2270,6165,8111,8966,1163,6801}

    Returns: 3

  6. {9970,4990,7182,360,4995,1492,6218,3264,2651,9542,8181,6341,6616,8548,5499,7607,9853,216,4117,1911,8041,4453,2139,1781,1717,9856,6719,7632,5798,9171,8163,8819,4534,1446,1353,8625,9739,1992,4436,5081,6619,370,8476,5833,5374,2815,176,1550,8192,6769}

    {5871,2886,9656,2443,7140,3893,9750,2390,5657,4115,9178,9586,8540,2560,9097,6526,2376,3708,2556,1963,1472,7114,7783,6762,8117,6065,3228,6845,151,1345,6601,8420,2851,3141,647,5092,8932,6081,3662,6351,4932,1790,692,7365,5659,3439,6830,5051,7391,2011}

    Returns: 6

  7. {3675,9561,886,4109,7731,3762,9922,4896,3490,4166,4562,3996,2386,156,9991,5068,6545,195,9356,3319,2590,2680,589,3706,7434,8618,6753,2560,7648,3317,4360,8384,1678,6945,7312,2420,2524,5709,9172,9051,1297,674,1582,812,3619,5443,5873,4632,5618,8063}

    {7362,450,9495,3800,6875,3121,6290,628,7569,187,2938,4379,7377,5528,5497,9895,2780,1749,6403,1688,6007,18,7264,6325,2325,2057,8052,1950,7355,8520,9096,940,7068,5368,7262,2829,5481,5336,3747,7011,7379,2849,9959,8320,2250,530,2786,4652,4762,9794}

    Returns: 7

  8. {2201,9369,4223,20,1238,1042,6393,6180,8718,3252,1719,8985,4996,1281,4957,9095,2963,5981,3776,2458,6878,9782,9180,6093,2193,8314,1523,55,5428,947,4450,7911,5744,5530,4926,7464,1415,3099,9244,4861,1066,649,6367,9355,7140,3134,4853,9734,2198,2874}

    {7682,6356,17,2513,6004,9995,7102,763,6389,5801,5251,3741,5372,2083,3777,7624,6342,2184,588,2826,3829,1440,5715,4739,8941,3116,5369,7027,8242,7763,4396,9683,4838,2915,1663,304,8060,4102,7609,5218,122,641,5654,7581,9100,29,8920,426,4662,6910}

    Returns: 7

  9. {1380,1970,8403,8453,3837,360,4883,4620,389,8114,6003,8556,8104,4684,8993,5421,7382,3946,6607,5062,6045,4599,8578,1839,3952,5335,6369,2225,7766,7147,3428,3861,9436,7024,1038,288,8707,5680,2182,8975,4576,6207,7505,6749,8173,3609,6390,5268,840,2487}

    {6370,6691,175,9403,1776,9883,5623,9252,9622,8046,5414,9377,5061,1177,5339,2846,5595,3730,1064,1626,4637,942,2592,3138,7422,7251,5762,8928,1822,317,6333,8621,4901,1695,5546,7839,3116,2156,9912,6998,7594,4220,3746,4235,1081,1441,8221,9646,9920,3291}

    Returns: 8

  10. {1528,4615,6849,8839,6887,3067,9023,9855,7659,4073,1194,8677,5110,3533,329,7153,3939,5485,3855,7235,3919,8440,4186,4365,7201,1993,1652,5511,2721,9865,1334,6724,5029,2133,8243,6323,3408,728,5390,1363,7483,4474,7350,5519,1516,2736,6927,8800,2888,1335}

    {2792,4281,543,5752,8568,3450,5019,6760,8505,2022,1755,2511,2992,9328,8211,8898,4310,8126,4773,9617,3109,5979,231,4137,5204,6056,6643,2232,2468,4308,1244,6364,3644,2779,404,5358,3953,325,2898,7484,1492,4828,7255,8700,7575,3217,3669,1587,3443,3432}

    Returns: 4

  11. {2435,7323,8581,3543,6305,154,1864,9835,2102,3907,9607,9950,10000,5790,9262,3593,5052,2565,436,6094,7268,4933,9632,941,8110,8493,637,8609,8867,6619,115,9120,8398,9945,2199,9291,5600,8256,2040,5526,9156,5540,5536,4206,5207,3214,7465,3818,7756,4277}

    {4849,3470,6691,4776,5011,8767,1667,4426,7802,353,1908,6407,1523,190,3930,511,4865,8878,1218,847,3192,9878,2551,3695,9275,5099,7645,521,3270,6984,9876,9053,1930,5489,8558,5305,8860,9620,7351,9224,4928,4324,8306,5953,1269,7783,8811,2441,6988,8335}

    Returns: 5

  12. {8323,1758,6849,3698,7724,7656,4191,1155,9926,7590,5426,1691,3525,8418,3543,1575,4543,1743,9223,8186,1296,3258,122,5576,7531,4158,1692,1995,3456,1457,4355,1507,1079,7257,1617,549,9780,5030,3807,5724,2728,9340,2480,5121,3538,1413,2451,7870,6195,306}

    {2251,8815,6552,5323,1457,8150,1691,451,6502,2167,9171,6950,3089,6663,6150,1424,4852,7019,4491,7819,4915,4197,3340,5885,2554,3774,3271,2312,1441,9642,2364,6093,8500,2983,8936,1878,2030,3093,8878,1414,7219,6366,92,8929,7686,893,6381,9427,2751,3544}

    Returns: 5

  13. {6065,4349,9727,5934,4849,6860,4211,5555,2639,6204,9864,1989,6708,4489,3712,6353,2432,931,2223,8035,5572,22,2632,878,6022,743,6642,4922,5661,5412,3991,6293,2985,2227,845,5426,9232,3348,1771,4181,2162,2801,4170,9555,6867,2132,3308,9530,708,1885}

    {4883,9544,1087,6502,4908,5897,1911,4880,4809,2011,6957,2573,3297,1037,332,2820,6809,2495,4465,9375,7594,444,5154,36,1036,4302,7931,3827,1823,6605,401,6818,7062,4788,7974,8721,3968,719,7379,3390,6858,4211,6852,3054,8651,366,2340,4549,2587,5756}

    Returns: 3

  14. {9399,793,2340,4868,9874,4465,4214,8258,5641,8636,1473,8675,8835,4469,4325,8294,7341,1250,8188,4726,9348,6197,8269,4303,9708,8212,2569,8194,5227,9969,9012,9722,6228,7122,1247,3251,6128,6163,3892,8341,4249,7412,1406,6709,66,3135,9941,3429,8854,8914}

    {8841,7221,8520,2137,9038,9504,5757,2962,4062,6884,4592,382,8176,1984,7731,46,595,8266,3170,2942,8110,4715,5498,8951,614,860,313,4036,3020,8198,9459,6081,4671,7076,8968,6207,8318,8158,8154,7549,5878,115,5969,4422,8065,1951,5539,2202,4240,6005}

    Returns: 4

  15. {1632,288,9958,4970,5459,5443,4455,7829,1692,9910,747,4047,2520,9084,4374,8154,9504,4585,5300,9238,5773,9752,4257,8152,1455,8752,411,1610,8518,5475,350,1462,937,8235,5531,8378,1084,6493,356,6598,815,8788,9699,759,4266,3148,3438,612,7144,6247}

    {7558,9668,2068,3054,5916,441,2392,329,8257,4885,9689,7306,6489,2763,6160,2927,5769,4429,49,8295,6908,9611,706,2393,2379,3357,1046,3832,3227,7406,3655,1304,4926,4668,5431,4457,3869,8056,8889,467,2342,8788,1872,8053,8741,5642,5013,7475,7578,1166}

    Returns: 4

  16. {7321,9127,5876,4500,4399,1113,1439,1962,859,6078,1201,5635,8720,8282,5484,1909,8771,3060,8540,8377,6978,1623,9477,7941,2346,3800,6729,7488,4275,3735,2147,3284,5184,1316,8741,317,1752,5488,6139,6056,7378,1899,8035,7925,9083,857,3780,6296,8297,4995}

    {1322,9767,4515,9514,7986,5478,9557,4187,4489,1527,9929,4027,291,1781,4005,5321,7660,302,100,7755,8131,1074,5428,5322,5860,1950,6958,711,1527,3105,912,8825,3109,6387,9646,8201,2103,5658,6956,6061,2267,4490,2434,6162,5471,3137,7404,3959,9819,7902}

    Returns: 4

  17. {3211,430,9425,2271,6876,3076,6393,107,3761,6425,8046,2280,2830,4245,7324,1919,7591,9988,3119,2649,3374,7979,1713,6141,844,855,9007,9559,8992,5628,6469,7893,6773,7899,5371,2324,717,3342,9236,3117,2262,557,5485,622,3967,4435,5436,6543,913,5044}

    {911,8035,3433,2590,5123,1605,8078,8263,3794,9474,3238,6829,8042,6449,78,9606,7270,5622,314,6697,1397,9751,567,251,8992,3940,1002,3283,1905,7049,5655,5104,8768,3139,4850,9348,1889,6260,165,1278,7969,1861,925,8408,6151,4755,3414,8397,8731,2760}

    Returns: 2

  18. {5413,4574,5604,4305,5389,6477,4178,5633,9901,4560,873,2461,8118,5714,3217,779,2005,8923,1572,2284,6872,5400,9697,8613,9363,9145,5116,7339,1981,9307,4022,1543,3237,1951,4139,4710,2956,4178,1651,3165,9464,1958,8712,7711,2886,5414,8280,8353,136,6789}

    {9544,2158,2001,4683,4981,1580,6144,3073,5581,6411,9304,5235,4288,7185,6699,4682,1511,8486,5290,2940,7364,2334,1793,293,5729,165,9639,6509,2340,470,7575,4627,5069,5016,5653,6298,570,3609,2160,9368,5473,4363,7135,7672,9600,5633,8785,4714,5468,7258}

    Returns: 6

  19. {7625,339,1829,6167,3943,9323,8042,392,8364,8268,6186,7457,2160,3450,1401,5357,3944,9246,2701,7042,3650,5936,8432,2600,6970,4998,3082,576,4970,7856,7631,1628,5729,2880,6702,2666,2974,4118,1365,5035,5947,9744,9531,6993,3022,315,2736,173,6330,1389}

    {7852,6940,3799,9406,4683,9563,7730,3423,2978,1772,4915,195,4216,3719,7851,3440,5987,2566,275,1654,5957,1250,4469,4867,7497,971,8066,3425,8536,8213,5339,5147,2790,6750,1823,5214,5080,9193,4807,3439,594,2672,8368,6393,8939,4316,8237,544,6194,3974}

    Returns: 3

  20. {6258,198,964,3942,2124,9811,4015,1734,3801,9831,9742,7546,6583,3099,9246,8322,451,8692,4231,7189,5551,6835,3851,5720,9838,652,2533,1080,4226,7640,6828,304,1023,3296,2214,4866,1550,5814,720,7701,3858,3358,8215,2503,2875,5623,1766,1394,8832,8343}

    {6246,1388,9421,2673,4310,9918,3882,8072,2304,3641,2222,1627,312,4094,1154,5034,2163,1888,5488,7610,7790,5088,167,9599,3838,90,7502,3812,8407,6914,6303,6531,8849,5588,3788,9244,4657,3991,1928,3641,5540,1855,5371,3165,7408,733,1972,1841,4710,197}

    Returns: 2

  21. {266,7170,3772,5949,2628,1177,8917,420,7253,5521,8095,8829,1457,616,1692,3931,7428,8135,2021,7252,1401,5277,1598,4493,126,4498,5578,4831,3845,6655,4220,3017,276,2475,4185,8628,5360,6509,1774,224,8123,4045,1025,1577,7872,2885,5442,7639,8567,714}

    {1518,8665,4437,7155,6190,128,4603,6742,7437,4731,1976,1978,3364,533,9729,8447,3209,8702,8649,5139,9391,8251,2271,914,2487,5495,6463,2756,9834,8270,1249,7449,1197,9525,851,5034,2267,4051,3162,5398,9243,3328,3945,3033,1146,9779,8107,5828,1463,2469}

    Returns: 5

  22. {8767,6675,301,6657,545,9287,9855,3265,378,3233,669,9205,7195,711,8779,9536,6475,7053,3693,147,5150,192,1629,5473,4225,4394,9967,8533,451,7323,8679,6483,6675,1325,3933,6921,9702,1400,6657,6355,2484,1111,825,1878,2656,5672,4644,4525,7261,7473}

    {4497,7071,2298,8286,2789,4368,6289,8699,1489,6146,2456,8410,5374,7763,2688,5838,9637,6589,3314,1330,1758,3777,9931,4156,3402,8263,1475,6675,789,2721,9653,3174,4771,9815,8289,2051,6124,1105,8136,7948,6457,6745,1111,3037,1817,944,3121,6329,4372,6330}

    Returns: 5

  23. {1552,4192,3650,3887,9237,3510,2424,2287,3500,9717,5506,7102,4311,6411,7759,4653,6021,6632,946,9816,1161,664,8953,5549,1529,3140,4687,8838,2719,9235,8556,9244,3474,7134,6435,7729,8031,4141,8728,6840,1110,1490,1017,4555,4502,8960,9362,7915,6761,6272}

    {7230,90,5931,4828,9944,4332,7233,5910,6364,6707,628,7928,5230,7752,4273,1159,4726,6777,1030,7462,8267,7497,2795,9546,9322,3768,5830,1786,3179,3778,4222,7758,6045,3422,7221,5772,1404,8429,8295,3524,3643,6541,6363,2656,5614,165,9837,499,3367,391}

    Returns: 3

  24. {442,8137,8979,3549,4065,6929,4250,201,2706,8493,8546,3783,4915,9966,6563,7514,7913,3356,6433,7708,3744,4138,6651,2356,7602,1715,1149,888,8425,4907,5282,2748,9862,9482,5526,9572,2264,9490,2053,5992,5756,7941,8912,480,5865,2187,3328,8753,242,2423}

    {8445,3898,6510,580,1099,3372,9415,2271,7441,2237,167,9770,4426,2089,3438,9852,7084,8906,3350,9413,3026,8887,976,9099,632,6177,2814,7225,177,8168,8269,7682,3367,4214,2724,1536,7169,5844,6963,7756,4781,4061,757,296,3099,2305,9470,5678,9095,2847}

    Returns: 7

  25. {3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900,3900}

    {3072,6382,5816,1717,6132,4586,1106,9672,3873,7650,3697,4119,2582,4469,8974,2912,210,9412,2139,817,7313,3166,4478,7220,7753,872,6433,8608,8206,9240,9084,9996,1841,6342,5098,8882,7210,7777,8041,587,1971,1300,2275,9681,4951,1934,3538,8017,9424,850}

    Returns: 50

  26. {9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153,9153}

    {1561,190,2949,3068,6299,1222,1260,5687,7603,6208,3040,8021,9310,9204,6306,8407,5476,4910,8261,3702,3336,3844,1537,3099,9979,601,5035,1922,1344,3736,427,4623,5794,1771,710,146,8971,8623,5301,3791,1288,4479,8103,7564,4670,9248,3309,3348,3389,8837}

    Returns: 50

  27. {5612,2806,4949,2317,4521,1633,9892,5437,2877,8438,4172,4900,1635,5816,3816,3157,2431,2098,4770,2121,8590,7975,1066,1740,8871,5510,1890,6732,9770,5323,6139,808,3961,2802,2387,8086,6407,6935,1012,4573,6693,1833,7478,558,9695,8455,809,5789,9395,9207}

    {6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050,6050}

    Returns: 50

  28. {7513,9299,7182,7109,653,8631,2344,7034,2389,858,3316,6375,7364,892,3978,5960,514,5244,3655,6658,8374,6441,343,4441,3688,6185,8666,8157,8214,7438,4730,704,8378,6294,2453,5888,9112,3975,3743,4354,3129,5707,3960,5498,1370,5239,3190,5939,245,5822}

    {7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754,7754}

    Returns: 50

  29. {8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927,8927}

    {6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406,6406}

    Returns: 50

  30. {5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592,5592}

    {477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477,477}

    Returns: 50

  31. {1, 1, 1, 1, 2 }

    {1, 1, 1, 1, 2 }

    Returns: 1

  32. {10, 30, 40 }

    {50, 30, 40 }

    Returns: 2


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: