fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main()
  5. {
  6. int t=0;
  7. cin>>t;
  8. while(t--)
  9. {
  10. int n,m,k;
  11. vector <int > jbs,chf,asst;
  12. cin>>n>>m;
  13.  
  14. for(int i=1;i<=n;i++)
  15. {
  16. jbs.push_back(i);//Enter all numbers from 1 to n in vector
  17. }
  18.  
  19. for(int i=0;i<m;i++)
  20. {
  21. cin>>k; //Get the job that is completed
  22. jbs[k-1]=0; //Erase the job that has been completed, make it 0
  23. }
  24.  
  25.  
  26. int flag=0;
  27. for(int i=0;i<jbs.size();i++)
  28. {
  29. if(jbs[i]==0)
  30. continue;
  31.  
  32. if(flag==0)
  33. {
  34. flag=1;//Change Flag so that it enters assistant job next time
  35. chf.push_back(jbs[i]);
  36. }
  37. else if(flag==1)
  38. {
  39. flag=0; //Change Flag so that it enters chef job next time
  40. asst.push_back(jbs[i]);
  41. }
  42. }
  43.  
  44. for(auto i:chf) //Lists all the elements of chef vector i.e jobs to be done by the chef
  45. cout<<i<<" ";
  46. cout<<"\n";
  47.  
  48.  
  49. for(auto i:asst) ////Lists all the elements of asst vector i.e jobs to be done by the assistant
  50. cout<<i<<" ";
  51. cout<<"\n";
  52. }
  53. return 0;
  54. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty