Knapsack problem

Hey I just learnt the knapsack algo and tried to solve http://www.codechef.com/problems/PPTEST/
but its showing WA.
This is my code

#include <iostream>

using namespace std;

int main() {

int t;
cin>>t;
while(t--)
{
 int time[110];
 int value[110];
 int W,N;
 cin>>N>>W;
 for(int h=1;h<=N;h++)
 { 
 	int t1,t2;
 	cin>>t1>>t2>>time[h];
 	value[h]=t1*t2;
 }	
 int a[100][100];		//value,time
 for(int l=0;l<N;l++)
 {
 	a[l][0]=0;		
 }

 for(int k=0;k<W;k++)
 {
 	a[0][k]=0;		
 }
for(int i=1;i<=N;i++)
{
	for(int y=1;y<=W;y++)
	{
		if(time[i]>y)
		{
			a[i][y]=a[i-1][y];
		}else
		{
			a[i][y]=max(a[i-1][y],(a[i-1][y-time[i]]+value[i]));
		}
	}
}
cout<<a[N][W];	
}
return 0;

}

The dp table size should be 101x101, because you need a[100][100] when N = 100, W = 100.
And the initialization loop limits should be l<=N and k<=W.