{"id":"4453919c-902b-424c-aae8-b8b0ec0c1b77","name":"Task Completion","description":"1. You are given two integers N and M, and an array(arr) of numbers with length M.\r\n2. N represents the total number of tasks assigned to a group of 5 students.\r\n3. Out of these five students, three students completed M number of tasks of their choices and left the group.\r\n4. Tasks completed by these students are represented by the given array.\r\n5. Now, the remaining two students(s1 and s2) have to complete all the remaining tasks.\r\n6. They decided to complete the remaining tasks in an alternate way -\r\n First of the remaining tasks will be completed by s1\r\n Second of the remaining tasks will be completed by s2\r\n Third of the remaining tasks will be completed by s1.. and so on. \r\n7. You have to find the tasks that s1 and s2 have to complete.","inputFormat":"Two Number N and M\r\narr1\r\narr2.. M numbers","outputFormat":"2 lines containing space-separated numbers.\r\nNumbers in first line represents the tasks that s1 have to complete.\r\nNumbers in second line represents the tasks that s2 have to complete. ","constraints":"1 &lt;= M,N &lt;= 10^3\r\n1 &lt;= arr[i] &lt;= 10^3","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nvoid completeTask(int n, int m, vector<int> num) {\n // write your code here\n}\n\nint main() {\n\tint n, m;\n\tcin>>n>>m;\n\tvector<int> num(m);\n\tfor(int i = 0 ; i < m; i++){\n\t\tint val;\n\t\tcin>>val;\n\t\tnum[i] = val;\n\t}\n\tcompleteTask(n, m, num);\n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n\t\r\n public static void completeTask(int n, int m, int[] arr) {\r\n\t\t// write your code here\r\n\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tint n = scn.nextInt();\r\n\t\tint m = scn.nextInt();\r\n\t\tint[] num = new int[m];\r\n\t\tfor (int i = 0; i < m; i++) {\r\n\t\t\tnum[i] = scn.nextInt();\r\n\t\t}\r\n\t\tcompleteTask(n, m, num);\r\n\t}\r\n\r\n}\r\n"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"15 6\r\n2 5 6 7 9 4","sampleOutput":"1 8 11 13 15 \r\n3 10 12 14 \r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"ec6515dc-6811-4c65-912f-0134b65df120","name":"HashMap and Heap For Intermediate","slug":"hashmap-and-heap-for-intermediate-10002","type":0},{"id":"ca759eb5-521c-4d0a-8c7e-3918417c277f","name":"Task Completion","slug":"task-completion","type":1}],"next":{"id":"1f6d263c-4c12-442b-8c7b-d21eba49d3ed","name":"Task Completion MCQ","type":0,"slug":"task-completion-mcq"},"prev":{"id":"ef613d20-f57f-4220-aef3-4740497a5285","name":"Smallest Subarray With All Occurrences Of The Most Frequent Element","type":3,"slug":"smallest-subarray-with-all-occurrences-of-the-most-frequent-element"}}}

Task Completion

1. You are given two integers N and M, and an array(arr) of numbers with length M. 2. N represents the total number of tasks assigned to a group of 5 students. 3. Out of these five students, three students completed M number of tasks of their choices and left the group. 4. Tasks completed by these students are represented by the given array. 5. Now, the remaining two students(s1 and s2) have to complete all the remaining tasks. 6. They decided to complete the remaining tasks in an alternate way - First of the remaining tasks will be completed by s1 Second of the remaining tasks will be completed by s2 Third of the remaining tasks will be completed by s1.. and so on. 7. You have to find the tasks that s1 and s2 have to complete.

{"id":"4453919c-902b-424c-aae8-b8b0ec0c1b77","name":"Task Completion","description":"1. You are given two integers N and M, and an array(arr) of numbers with length M.\r\n2. N represents the total number of tasks assigned to a group of 5 students.\r\n3. Out of these five students, three students completed M number of tasks of their choices and left the group.\r\n4. Tasks completed by these students are represented by the given array.\r\n5. Now, the remaining two students(s1 and s2) have to complete all the remaining tasks.\r\n6. They decided to complete the remaining tasks in an alternate way -\r\n First of the remaining tasks will be completed by s1\r\n Second of the remaining tasks will be completed by s2\r\n Third of the remaining tasks will be completed by s1.. and so on. \r\n7. You have to find the tasks that s1 and s2 have to complete.","inputFormat":"Two Number N and M\r\narr1\r\narr2.. M numbers","outputFormat":"2 lines containing space-separated numbers.\r\nNumbers in first line represents the tasks that s1 have to complete.\r\nNumbers in second line represents the tasks that s2 have to complete. ","constraints":"1 &lt;= M,N &lt;= 10^3\r\n1 &lt;= arr[i] &lt;= 10^3","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nvoid completeTask(int n, int m, vector<int> num) {\n // write your code here\n}\n\nint main() {\n\tint n, m;\n\tcin>>n>>m;\n\tvector<int> num(m);\n\tfor(int i = 0 ; i < m; i++){\n\t\tint val;\n\t\tcin>>val;\n\t\tnum[i] = val;\n\t}\n\tcompleteTask(n, m, num);\n}"},"java":{"code":"import java.util.*;\r\n\r\npublic class Main {\r\n\t\r\n public static void completeTask(int n, int m, int[] arr) {\r\n\t\t// write your code here\r\n\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tint n = scn.nextInt();\r\n\t\tint m = scn.nextInt();\r\n\t\tint[] num = new int[m];\r\n\t\tfor (int i = 0; i < m; i++) {\r\n\t\t\tnum[i] = scn.nextInt();\r\n\t\t}\r\n\t\tcompleteTask(n, m, num);\r\n\t}\r\n\r\n}\r\n"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"15 6\r\n2 5 6 7 9 4","sampleOutput":"1 8 11 13 15 \r\n3 10 12 14 \r\n","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"ec6515dc-6811-4c65-912f-0134b65df120","name":"HashMap and Heap For Intermediate","slug":"hashmap-and-heap-for-intermediate-10002","type":0},{"id":"ca759eb5-521c-4d0a-8c7e-3918417c277f","name":"Task Completion","slug":"task-completion","type":1}],"next":{"id":"1f6d263c-4c12-442b-8c7b-d21eba49d3ed","name":"Task Completion MCQ","type":0,"slug":"task-completion-mcq"},"prev":{"id":"ef613d20-f57f-4220-aef3-4740497a5285","name":"Smallest Subarray With All Occurrences Of The Most Frequent Element","type":3,"slug":"smallest-subarray-with-all-occurrences-of-the-most-frequent-element"}}}
plane

Editor


Loading...

Task Completion

easy

1. You are given two integers N and M, and an array(arr) of numbers with length M. 2. N represents the total number of tasks assigned to a group of 5 students. 3. Out of these five students, three students completed M number of tasks of their choices and left the group. 4. Tasks completed by these students are represented by the given array. 5. Now, the remaining two students(s1 and s2) have to complete all the remaining tasks. 6. They decided to complete the remaining tasks in an alternate way - First of the remaining tasks will be completed by s1 Second of the remaining tasks will be completed by s2 Third of the remaining tasks will be completed by s1.. and so on. 7. You have to find the tasks that s1 and s2 have to complete.

Constraints

1 <= M,N <= 10^3 1 <= arr[i] <= 10^3

Format

Input

Two Number N and M arr1 arr2.. M numbers

Output

2 lines containing space-separated numbers. Numbers in first line represents the tasks that s1 have to complete. Numbers in second line represents the tasks that s2 have to complete.

Example

Sample Input

15 6 2 5 6 7 9 4

Sample Output

1 8 11 13 15 3 10 12 14

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode