Doubt regarding question

#include

using namespace std;

int main()
{
int n;
cin>>n;
int row=1;
while(row<=n)
{
int col=1;
if(row%2!=0)

     {
         //odd
         while(col<=row)
         {


         cout<<1<<" ";
         col=col+1;
         }
     }
     else
     {
         //even
         cout<<1;
         while(col<=row-2)
         {
             cout<<0;
             col = col +1;
         }
         cout<<1;
     }
     cout<<endl;
     row=row+1;
 }
return 0;

}

I HAVE WRITTEN THIS CODE RUNNING ON CODE BLOCKS BUT SHOWING the WRONG ANSWER IN HACKERBLOCK PLZ SEE TO IT

please dont insert a space after printing 1 possibly line 22 of the code