{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":618708712,"defaultBranch":"main","name":"CodeChef_Solutions","ownerLogin":"Aftabmallick","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-03-25T05:38:04.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/78075420?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1679722835.0","currentOid":""},"activityList":{"items":[{"before":"51848ff7cacfcb075d1f0bc48b3c4fa1bde805bf","after":"0125bb023dd65f624c226c32d2951cc6a59828f7","ref":"refs/heads/main","pushedAt":"2023-03-25T06:29:34.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"Aftabmallick","name":"Aftab Mallick","path":"/Aftabmallick","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/78075420?s=80&v=4"},"commit":{"message":"Create REACH_HOME(Reach Home codechef).py","shortMessageHtmlLink":"Create REACH_HOME(Reach Home codechef).py"}},{"before":"013906cb6178ab5efda31530227e5abfa0b553cc","after":"51848ff7cacfcb075d1f0bc48b3c4fa1bde805bf","ref":"refs/heads/main","pushedAt":"2023-03-25T06:27:54.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"Aftabmallick","name":"Aftab Mallick","path":"/Aftabmallick","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/78075420?s=80&v=4"},"commit":{"message":"Create OPMIN(MIN TO MAX codechef).py\n\nProblem\r\nYou are given an array \r\n�\r\nA of size \r\n�\r\nN.\r\n\r\nLet \r\n�\r\nM be the minimum value present in the array initially.\r\nIn one operation, you can choose an element \r\n�\r\n�\r\nA \r\ni\r\n​\r\n \r\n(\r\n1\r\n≤\r\n�\r\n≤\r\n�\r\n)\r\n(1≤i≤N) and an integer \r\n�\r\nX \r\n(\r\n1\r\n≤\r\n�\r\n≤\r\n100\r\n)\r\n(1≤X≤100), and set \r\n�\r\n�\r\n=\r\n�\r\nA \r\ni\r\n​\r\n =X.\r\n\r\nDetermine the minimum number of operations required to make \r\n�\r\nM the maximum value in the array \r\n�\r\nA.\r\n\r\nInput Format\r\nThe first line of input will contain a single integer \r\n�\r\nT, denoting the number of test cases.\r\nEach test case consists of multiple lines of input.\r\nThe first line of each test case contains a single integer \r\n�\r\nN - the size of the array.\r\nThe next line of each test case contains \r\n�\r\nN space-separated integers \r\n�\r\n1\r\n,\r\n�\r\n2\r\n,\r\n…\r\n,\r\n�\r\n�\r\nA \r\n1\r\n​\r\n ,A \r\n2\r\n​\r\n ,…,A \r\nN\r\n​\r\n - the elements of the array.\r\nOutput Format\r\nFor each test case, output on a new line, the minimum number of operations required to make \r\n�\r\nM the maximum value in the array \r\n�\r\nA.\r\n\r\nConstraints\r\n1\r\n≤\r\n�\r\n≤\r\n100\r\n1≤T≤100\r\n1\r\n≤\r\n�\r\n≤\r\n100\r\n1≤N≤100\r\n1\r\n≤\r\n�\r\n�\r\n≤\r\n100\r\n1≤A \r\ni\r\n​\r\n ≤100\r\nSample 1:\r\nInput\r\nOutput\r\n3\r\n2\r\n1 2\r\n4\r\n2 2 3 4\r\n1\r\n1\r\n1\r\n2\r\n0\r\nExplanation:\r\nTest case \r\n1\r\n1: The minimum value in the array, \r\n�\r\nM, is initially \r\n1\r\n1. We can use one operation as following:\r\n\r\nChoose \r\n�\r\n2\r\nA \r\n2\r\n​\r\n and set it as \r\n�\r\n=\r\n1\r\nX=1. Thus, the final array becomes \r\n[\r\n1\r\n,\r\n1\r\n]\r\n[1,1].\r\nSince all elements of the final array are \r\n1\r\n1, the maximum value of the array is now \r\n1\r\n1. It can be shown that this is the minimum number of operations required to do so.\r\n\r\nTest case \r\n2\r\n2: The minimum value in the array, \r\n�\r\nM, is initially \r\n2\r\n2. We can use two operations as following:\r\n\r\nChoose \r\n�\r\n4\r\nA \r\n4\r\n​\r\n and set it as \r\n�\r\n=\r\n2\r\nX=2. Thus, the array becomes \r\n[\r\n2\r\n,\r\n2\r\n,\r\n3\r\n,\r\n2\r\n]\r\n[2,2,3,2].\r\nChoose \r\n�\r\n3\r\nA \r\n3\r\n​\r\n and set it as \r\n�\r\n=\r\n2\r\nX=2. Thus, the array becomes \r\n[\r\n2\r\n,\r\n2\r\n,\r\n2\r\n,\r\n2\r\n]\r\n[2,2,2,2].\r\nSince all elements of the final array are \r\n2\r\n2, the maximum value of the array is now \r\n2\r\n2.\r\n\r\nTest case \r\n3\r\n3: The minimum value in the array, \r\n�\r\nM, is initially \r\n1\r\n1. It is also the maximum value of the array. Hence, no operations are required.","shortMessageHtmlLink":"Create OPMIN(MIN TO MAX codechef).py"}},{"before":"185ddd7b8544110abfe706aa1ca87c2bea04eeee","after":"013906cb6178ab5efda31530227e5abfa0b553cc","ref":"refs/heads/main","pushedAt":"2023-03-25T06:12:03.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"Aftabmallick","name":"Aftab Mallick","path":"/Aftabmallick","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/78075420?s=80&v=4"},"commit":{"message":"Create CANDIVIDE(Candy Division codechef).py\n\nProblem\r\nThere are three friends and a total of \r\n�\r\nN candies.\r\nThere will be a fight amongst the friends if all of them do not get the same number of candies.\r\n\r\nChef wants to divide all the candies such that there is no fight. Find whether such distribution is possible.\r\n\r\nInput Format\r\nThe first line of input will contain a single integer \r\n�\r\nT, denoting the number of test cases.\r\nEach test case consists of a single integer \r\n�\r\nN - the number of candies.\r\nOutput Format\r\nFor each test case, output YES, if we can distribute all the candies between the three friends equally. Otherwise output NO.\r\n\r\nYou can output each character of the answer in uppercase or lowercase. For example, the strings yEs, yes, Yes, and YES are considered the same.\r\n\r\nConstraints\r\n1\r\n≤\r\n�\r\n≤\r\n100\r\n1≤T≤100\r\n1\r\n≤\r\n�\r\n≤\r\n100\r\n1≤N≤100\r\nSample 1:\r\nInput\r\nOutput\r\n4\r\n3\r\n4\r\n2\r\n6\r\nYES\r\nNO\r\nNO\r\nYES\r\nExplanation:\r\nTest case \r\n1\r\n1: Chef can distribute all \r\n3\r\n3 candies such that each friend gets \r\n1\r\n1 candy. Since all three friends have same number of candies, there is no fight.\r\n\r\nTest case \r\n2\r\n2: There exist no way of distributing all candies such that all three friends have same number of candies.\r\n\r\nTest case \r\n3\r\n3: There exist no way of distributing all candies such that all three friends have same number of candies.\r\n\r\nTest case \r\n4\r\n4: Chef can distribute all \r\n6\r\n6 candies such that each friend gets \r\n2\r\n2 candies. Since all three friends have same number of candies, there is no fight.","shortMessageHtmlLink":"Create CANDIVIDE(Candy Division codechef).py"}},{"before":"464554e3978df026694f4f92e136c3e04a526f79","after":"185ddd7b8544110abfe706aa1ca87c2bea04eeee","ref":"refs/heads/main","pushedAt":"2023-03-25T05:41:14.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"Aftabmallick","name":"Aftab Mallick","path":"/Aftabmallick","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/78075420?s=80&v=4"},"commit":{"message":"Rename AVGPERM(Average Permutation).py to AVGPERM(Average Permutation codechef).py","shortMessageHtmlLink":"Rename AVGPERM(Average Permutation).py to AVGPERM(Average Permutation…"}},{"before":null,"after":"464554e3978df026694f4f92e136c3e04a526f79","ref":"refs/heads/main","pushedAt":"2023-03-25T05:40:35.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"Aftabmallick","name":"Aftab Mallick","path":"/Aftabmallick","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/78075420?s=80&v=4"},"commit":{"message":"Create AVGPERM(Average Permutation).py\n\nProblem\r\nYou are given an integer \r\n�\r\nN.\r\n\r\nFind a permutation \r\n�\r\n=\r\n[\r\n�\r\n1\r\n,\r\n�\r\n2\r\n,\r\n…\r\n,\r\n�\r\n�\r\n]\r\nP=[P \r\n1\r\n​\r\n ,P \r\n2\r\n​\r\n ,…,P \r\nN\r\n​\r\n ] of the integers \r\n{\r\n1\r\n,\r\n2\r\n,\r\n…\r\n,\r\n�\r\n}\r\n{1,2,…,N} such that sum of averages of all consecutive triplets is minimized, i.e.\r\n\r\n∑\r\n�\r\n=\r\n1\r\n�\r\n−\r\n2\r\n�\r\n�\r\n+\r\n�\r\n�\r\n+\r\n1\r\n+\r\n�\r\n�\r\n+\r\n2\r\n3\r\ni=1\r\n∑\r\nN−2\r\n​\r\n \r\n3\r\nP \r\ni\r\n​\r\n +P \r\ni+1\r\n​\r\n +P \r\ni+2\r\n​\r\n \r\n​\r\n \r\nis minimized.\r\n\r\nIf multiple permutations are possible, print any of them.\r\n\r\nInput Format\r\nThe first line of input will contain a single integer \r\n�\r\nT, denoting the number of test cases.\r\nThe first and only line of each test case contains an integer N, the size of the permutation.\r\nOutput Format\r\nFor each test case, output on a new line a permutation which satisfies the above conditions.\r\n\r\nConstraints\r\n1\r\n≤\r\n�\r\n≤\r\n1000\r\n1≤T≤1000\r\n3\r\n≤\r\n�\r\n≤\r\n1\r\n0\r\n5\r\n3≤N≤10 \r\n5\r\n \r\nThe sum of \r\n�\r\nN over all test cases won't exceed \r\n3\r\n⋅\r\n1\r\n0\r\n5\r\n3⋅10 \r\n5\r\n .\r\nSample 1:\r\nInput\r\nOutput\r\n2\r\n4\r\n3\r\n3 2 1 4\r\n3 2 1\r\nExplanation:\r\nTest case \r\n1\r\n1: The sum is \r\n�\r\n1\r\n+\r\n�\r\n2\r\n+\r\n�\r\n3\r\n3\r\n+\r\n�\r\n2\r\n+\r\n�\r\n3\r\n+\r\n�\r\n4\r\n3\r\n=\r\n3\r\n+\r\n2\r\n+\r\n1\r\n3\r\n+\r\n2\r\n+\r\n1\r\n+\r\n4\r\n3\r\n=\r\n6\r\n/\r\n3\r\n+\r\n7\r\n/\r\n3\r\n=\r\n4.333\r\n…\r\n3\r\nP \r\n1\r\n​\r\n +P \r\n2\r\n​\r\n +P \r\n3\r\n​\r\n \r\n​\r\n + \r\n3\r\nP \r\n2\r\n​\r\n +P \r\n3\r\n​\r\n +P \r\n4\r\n​\r\n \r\n​\r\n = \r\n3\r\n3+2+1\r\n​\r\n + \r\n3\r\n2+1+4\r\n​\r\n =6/3+7/3=4.333… Among all possible permutations of \r\n{\r\n1\r\n,\r\n2\r\n,\r\n3\r\n,\r\n4\r\n}\r\n{1,2,3,4}, this is one of the permutations which provides the minimum result.\r\n\r\nTest case \r\n2\r\n2: The sum is \r\n3\r\n+\r\n2\r\n+\r\n1\r\n3\r\n=\r\n6\r\n/\r\n3\r\n=\r\n2\r\n3\r\n3+2+1\r\n​\r\n =6/3=2. Every permutation of size \r\n3\r\n3 will have this value, hence it is the minimum possible.","shortMessageHtmlLink":"Create AVGPERM(Average Permutation).py"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAADCwG17QA","startCursor":null,"endCursor":null}},"title":"Activity · Aftabmallick/CodeChef_Solutions"}