Can someone find error in this code

https://www.codechef.com/problems/CLEANUP
this is the link of problem.

link of my solution:
https://www.codechef.com/viewsolution/26893731

my solution:

    #include <bits/stdc++.h>
    using namespace std;

    int main() {
    	int t;
    	cin>>t;
    	while(t--){
    	   int n,m;
    	   cin>>n>>m;
    	   int arr[m+1];
    	   for(int i = 1;i<= m ;i++){
            cin>>arr[i];
    	   }
    	   sort(arr+1,arr+m+1);
    	   for(int i=1;i<=n;i=i+2){
                bool condi = true;
            for(int j=1;j<=m;j++){
                if(i==arr[j]){
                   condi = false;
                   break;
                }
            }
           if(condi)
            cout<<i << " ";
    	   }
    	   cout << "\n";

	   for(int i=2;i<=n;i=i+2){
            bool condi = true;
        for(int j=1;j<=m;j++){
            if(i==arr[j]){
               condi = false;
               break;
            }
        }
       if(condi)
        cout<<i <<" ";
	   }
	   cout << "\n";

	}
	return 0;
}

Please either format your code or link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

okay i will add link

1 Like