My solution to the question with code CLEANUP works well for all the public cases, and all other cases I have tried. However, when I submit it, it shows Wrong Answer. Please help me here!
#include
#include
using namespace std;
int main() {
int t;
cin >> t;
for(int i = 0; i < t ; i++)
{
int n , m, doer = 0;
cin >> n >> m;
char jobs[n+1];
int jdone = 0;
//storing the jobs done
for(int j = 0; j < m ; j++ )
{
cin >> jdone;
jobs[jdone] = 'd';
}
//storing which jobs chef and which the assisstant will do
for(int k = 1; k < n+1 ; k++)
{
if(jobs[k] == 'd')
continue;
else
{
if(doer % 2 == 0)
{
jobs[k] = 'c';
}
else
jobs[k] = 'a';
doer++;
}
}
//printing out chef's jobs
for(int l = 1; l < n+1; l++)
{
if(jobs[l] == 'c')
{
cout << l << " " ;
}
}
cout << endl;
//printing out assisstant;s jobs
for(int l2 = 0; l2 < n+1; l2++)
{
if(jobs[l2] == 'a')
{
cout << l2 << " " ;
}
}
cout << endl;
}
return 0;
}