I am getting wrong answer though i got correct ouput in codeblocks.

#include
using namespace std;
int N=0,K=0,k=0,T=0,i=0,j=0;
int A[10000]; int arr[100][100];
int main()
{

cin>>T;
for(i=1;i<=T;i++)
{ N=0; K=0; cin>>N>>K;
for(j=1;j<=N;j++)
{ cin>>A[j];

  if(K>=A[j]) {K-=A[j]; arr[i][j]=1; }
  else arr[i][j]=0;;
 }
 arr[i][j]=-1;

}

for(i=1;i<=T;i++)
{ cout<<endl;
for(j=1;arr[i][j]!=-1;j++)
cout<<arr[i][j];
}

return 0;
}

//