# what is wrong in this...Q-fill the matrix(sep long chall)

#include
#include
using namespace std;
main()
{
int t,n,q,k,f;
cin>>t;
for(int w=0;w<t;w++)
{
f=0;
cin>>n>>q;
int v[q+1],a[n+3],i[q+1],j[q+1];
for(k=0;k<q;k++)
{
cin>>i[k]>>j[k]>>v[k];
if(i[k]==j[k] && v[k]!=0)
f=-1;
}
if(f==0)
{
for(k=0;k<n+3;k++)
a[k]=0;
for(k=0;k<q;k++)
{
if(a[i[k]-1]==0 && a[j[k]-1]==0)
{
if(v[k]==0)
a[i[k]-1]=a[j[k]-1]=1;
else if(v[k]==1)
{
a[i[k]-1]=2;
a[j[k]-1]=1;
}
}
else if(a[i[k]-1]==0 && a[j[k]-1]!=0)
{
if(v[k]==0)
a[i[k]-1]=a[j[k]-1];
else if(v[k]==1)
{
if(a[j[k]-1]==1)
a[i[k]-1]=2;
else if(a[j[k]-1]==2)
a[i[k]-1]=1;
}
}
else if(a[j[k]-1]==0 && a[i[k]-1]!=0)
{
if(v[k]==0)
a[j[k]-1]=a[i[k]-1];
else if(v[k]==1)
{
if(a[i[k]-1]==1)
a[j[k]-1]=2;
else if(a[i[k]-1]==2)
a[j[k]-1]=1;
}
}
else if(a[i[k]-1]!=0 && a[j[k]-1]!=0)
{
if(abs(a[i[k]-1]-a[j[k]-1])!=v[k])
{
f=-1;
break;
}
}
}
}
if(f==-1)
cout<<“no\n”;
else
cout<<“yes\n”;
}
}

you something wrong that #include<iostream.h> you not write .h

dude…see only logical error…there is no syntax error

how can i indent it properly…

Some explanation on what you tried to do will help.

//